In this post i am going to show you how use jquery in asp.net to select the checkbox of Checkbox List
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadioButtonListJquery.aspx.cs" Inherits="RadioButtonListJquery" %> <!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 runat="server"> <title></title> <script src="Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $("#selectAll").click(function () { $("input[type='checkbox'").not("#selectAll").each(function () { $(this).attr("checked", "true"); }); }); }); </script> </head> <body> <form id="form1" runat="server"> <input type="button" value="Select All" id="selectAll" /> <div id="divLanguage"> <asp:CheckBoxList ID="chkList" runat="server"> <asp:ListItem Text="C#" Value="1"></asp:ListItem> <asp:ListItem Text="Java" Value="1"></asp:ListItem> <asp:ListItem Text="C++" Value="1"></asp:ListItem> <asp:ListItem Text="C" Value="1"></asp:ListItem> </asp:CheckBoxList> </div> </form> </body> </html>


No comments:
Post a Comment