Drop down Value getting in C#:
DropDownID.SelectedIndex = DropDownID.Items.IndexOf(DropDownID.Items.FindByValue("Your string"));
radio button list selected value getting from jquery
.asp<asp:RadioButtonList ID="rblOptions" runat="server"></asp:RadioButtonList>
Jquery
var rblOpetions=$("#<%=rblOptions.ClientID %>").find("input[checked]").val();
///clear all textbox values using Jquery
$("#<%=aspxcontrolID.ClientID%>").find("input:text").val('');
//set all dropdownlist values selected index is Zero
$('#<%=dvDetails.ClientID%> select option:first-child').attr("selected","selected");$("#country option[value='United State']").attr("disabled", true);
uncheck all check boxes using jquery
$(document).ready(function(){
$('.check:button').toggle(function(){
$('input:checkbox').attr('checked','checked');
$(this).val('uncheck all')
},function(){
$('input:checkbox').removeAttr('checked');
$(this).val('check all');
})
})
Grdiveiw radio buttons unchecked using jquery
//unselected all radio buttons with in a grid
$("#<%=gvOderDetails.ClientID%>").find("input:radio:checked").prop('checked',false);
//unselected all radio buttons with in control/panel/div etc...
$("#<%=Usercontrols.ClientID%>").find("input:radio:checked").prop('checked',false);
(OR)
$('form[id^="form-"]').find("input:radio:checked").removeProp('checked');
value multiplications and retriving data
function RateCalc(){
var v1=parseFloat($("#<%=txtPartQuantity.ClientID%>").val());
var vf1=parseFloat($("#<%=txtRate.ClientID%>").val());
var r1=v1*vf1;
$("#<%=txtValue.ClientID%>").val(r1);
$("#<%=txtCtryOrigin.ClientID%>").focus();
return false;
}
jQuery – Get All controls Whose ID Starts With
Grid view check box checked changed:
$("#YourGridName input:checkbox[id*=putyourid]").attr('checked', true);
id contained all check boxes checked is true.
refference:http://weblogs.asp.net/psperanza/archive/2009/05/07/jquery-selectors-selecting-elements-by-a-partial-id.aspx
your .aspx page:
<asp:TextBox ID="txtExample" runat="server" />
Then your jQuery can easily find that control, even if it's mangled by the master page rendering, like this:
$("[id$=txtExample]")
The
$=
operator matches the end of the string and the name mangling is always on the front. Once you've done that, you can get the actual mangled ID like this:$("[id$=txtExample]").attr("id")
and then parse that anyway you see fit.
EDIT: This is an easy way, but it may be more of a performance hit than just giving each control a class the same as its old ID.
Disable all input controls Using jQuery
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/themes/base/jquery-ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('input[id$=\'TestButton\']').click(function() { $('input, select, textarea').not(this).attr('disabled', 'disabled'); return false; }); }); </script> </head> <body> <form id="form1" runat="server"> <asp:TextBox runat="server"></asp:TextBox> <br /> <asp:DropDownList runat="server"> <asp:ListItem>Text1</asp:ListItem> <asp:ListItem>Text2</asp:ListItem> </asp:DropDownList> <br /> <asp:TextBox runat="server" TextMode="MultiLine"></asp:TextBox> <br /> <asp:ListBox runat="server"> <asp:ListItem>Text1</asp:ListItem> <asp:ListItem>Text2</asp:ListItem> </asp:ListBox> <asp:Button ID="TestButton" runat="server" Text="Test" /> </form> </body>
No comments:
Post a Comment