简体   繁体   中英

How Can i Access values from .aspx page to .aspx.cs page?

I have code something like this.

ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Submit", "Confirm()", true);

Confirm is the JavaScript function in .aspx page. I want to catch the "true" or "False" value returned based on the Click performed on the Confirm window to my code behind(aspx.cs) page.

Do we have a solution for this?

i tried this way to do it

function a()
{
  document.getElementById('<%=h1.ClientID)%>').value=0;
}
<%=Method() %>  

这会有所帮助吗?

Add a hidden field in ur .aspx page and on submit assign proper value to the hidden field from jQuery or javascript

function submit()
{ 
    var value="sumting"; 
    $("input[id$=hdnFldValue]").val(value);
}

In the Code behind u will get the hidden field value now u can perform ur desired task.

Hope it will help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM