Nov 10, 2011

How to assign a value to a hidden field using JavaScript in ASP.NET


We can use JavaScript to set the value of a hidden control and get its value at the server after a post back.
<input id="Hidden1" type="hidden" />
<script type="text/JavaScript">
var str=”hello
document.getElementByID(“Hidden1”).value=str</script>
protected void Page_Load(object sender, EventArgs e)
{
    string str=request["Hidden1"].ToString();
}
Related posts:

0 comments:

Post a Comment

Your comments:

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More