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) :)
精彩评论