Xpode.com        Click here to Print this article.

how to call the asp.net controls using jquery in the client side?

Get Label Value:

$('#<%=Label.ClientID%>').text();

 Set label value:

$('#<%=Label.ClientID%>').text("New Value");

 

Get Textbox value:

$('#<%=TextBox.ClientID%>').val();

  Set Textbox value:

$('#<%=TextBox.ClientID%>').val("New Value");

 Get Dropdown value:

$('#<%=DropDownList.ClientID%>').val();

 Set Dropdown value:

$('#<%=DropDownList.ClientID%>').val("New Value");

 Get text of selected item in dropdown:

$('#<%=DropDownList.ClientID%> option:selected').text();

 Get Checkbox Status:

$('#<%=CheckBox.ClientID%>').attr('checked');

 Check the Checkbox:

$('#<%=CheckBox.ClientID%>').attr('checked',true);

 Uncheck the Checkbox:

$('#<%=CheckBox.ClientID%>').attr('checked',false);

Get Radiobutton Status:

$('#<%=RadioButton.ClientID%>').attr('checked');

 Check the RadioButton:

$('#<%=RadioButton.ClientID%>').attr('checked',true);

 Uncheck the RadioButton:

$('#<%=RadioButton.ClientID%>').attr('checked',false);

 Disable any control:

$('#<%=TextBox.ClientID%>').attr('disabled', true);

 Enable any control:

$('#<%=TextBox.ClientID%>').attr('disabled', false);

 Make textbox read only:

$('#<%=TextBox.ClientID%>').attr('readonly', 'readonly');



http://
http://

Contributed by:
rajeev chandra
hi this is rajeev

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=615

Click here to go on website