Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




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');

Share this article   |    Print    |    Article read by 2632 times
Author:
rajeev chandra
hi this is rajeev
Related Articles: No related article
Related Interview Questions: No related interview question