- Today I'll show you how to retrieve the server controls data easily using Javascript in ASP.NET.
- Normally people I have seen use to retrieve the data from controls is using something like this:
function validate()
{
var text=document.getElementById('<%=TextBox1.ClientId%>').value;
// do stuffs
}
- And then more code for if you want dropdownlist data and some other controls.
- Instead simply one can use String function as (e.g. for DropDownList):
function validate()
{
var text=String('<%=DropDownList1.SelectedItem.Text%>');
var value=String('<%=DropDownList1.SelectedItem.Value%>');
// do stuffs
}
- That was for this blog have a great day. And yes any one having difficulty can comment anytime.
No comments:
Post a Comment