开发者

how to get the value of client side variable in server side

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

From this code :

 protected void btnSubmit_Click(object sender, EventArgs e)
 {
    string script = "var title = $('.rsApt').attr('t开发者_JS百科itle');";
    ClientScript.RegisterStartupScript(GetType(),"popup", script, true);
  }

Thanks


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

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


you can:

1- add a HiddenField to your page.

2- get the value you want to store from your DOM element

3- save your value to the HiddenField value.

4- From your serverside code, read the HiddenField value.

5- smile.

6- Mark this post as (answer) :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜