如何在服务器端获取客户端变量的值 [英] how to get the value of client side variable in server side

查看:108
本文介绍了如何在服务器端获取客户端变量的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下如何获取var title的值:

I want to ask how to get the value of var title :

通过此代码:

 protected void btnSubmit_Click(object sender, EventArgs e)
 {
    string script = "var title = $('.rsApt').attr('title');";
    ClientScript.RegisterStartupScript(GetType(),"popup", script, true);
  }

谢谢

推荐答案

您必须将其重新发布,脚本在客户端上运行,因此需要将其值传递给服务器.

You'll have to post it back, the script runs on the client so its value needs to be passed to the server.

一种常见的方法是将var title插入文本框,然后将其发布到服务器.

A common method is to insert var title into a textbox, which then gets POSTed to the server.

这篇关于如何在服务器端获取客户端变量的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆