Another Salesforce blog!!!

Salesforce, Apex

JQUERY

Selector using contain Id in Jquery

function detailTRSelected() { $(“[id*=’parent’]”).click(function(){ $(this).addClass(“selected”).siblings().removeClass(“selected”); }); }

Selector using Class in JQuery

$.each($(‘.thePanel’), function() { var myid = this.id; });

Jquery Selectors

Following are the Jquery selectors: ^= is starts with $= is ends with = is exactly equal != is not equal *= is contains

Check to see what checkbox is checked (looping)

  //flag for to check weather any option is selected or not. Default to all selected.         var flag = false;         //Retrieves controls for which the drop down selected option is set.         var dropDownControls = $(‘#<%=gv.ClientID %> select option:selected’);         var checkboxes = $(“.selectreject input[type=’checkbox’]”);         for (index = 0; index < checkboxes.length; […]

Check-All checkbox using GridView (asp.net)

&lt;asp:CheckBox ID=”chkRejectAll” CssClass=”selectreject” runat=”server” onclick=”javascript:SelectAllRejectCheckboxes(this, ‘.selectreject’);” /&gt; //select reject all checkbox     function SelectAllRejectCheckboxes(chk, selector) {         $(‘#&lt;%=gv.ClientID%&gt;’).find(selector + ” input:checkbox”).not(‘checked’).each(function () {             $(this).prop(“checked”, $(chk).prop(“checked”));         }); } &nbsp;

Check Or Uncheck Checkboxes within GridView in ASP.NET using JQuery

How to implement check and uncheckboxes within the gridview control using asp.net: Source: Introduction Today I have implemented to my project to check and uncheck all checkboxes within gridview in asp.net. So in this article we focus how to implement this features using JQuery with less code. And also I have given live demonstration as […]

How to grab the text inside the TextBox in ASP.NET using jQuery

   var _comment = $(“#[id*=’commentEdit’]”).val();  <asp:TextBox runat=”server” ID=”txtNewComments”  MaxLength=”300″ TextMode=”MultiLine” Rows=”7″ Width=”100%”></asp:TextBox>

How to restrict the user to allow only one checkbox of each checked?

i have a two columns (approve all/reject all) how to restrict the user to allow only one checkbox of each? output screen <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat=”server”> <title></title> <script src=”Scripts/jquery-1.4.1.min.js” type=”text/javascript”></script> </head> <body> <form id=”form1″ runat=”server”> <div> <table border=”1″> <tr> <td><input type=”checkbox” id=”C1All” />Approve All</td> <td><input type=”checkbox” id=”C2All” />Reject All</td> </tr> <tr> <td><input type=”checkbox” id=”C101″ class=”col1″ />John […]

Gridview itemTemplate enable/disable the dropdownlist based on the checkbox checked using jQuery

 <ItemTemplate>              <div>                 <asp:CheckBox CssClass=”selectme” ID=”chkReject” runat=”server” Checked=”false”>                 </asp:CheckBox>                 <asp:DropDownList runat=”server” ID=”detail” >                     <asp:ListItem Selected=”True” Value=”0″>Select me</asp:ListItem>                     <asp:ListItem Value=”1″>one</asp:ListItem>                     <asp:ListItem Value=”2″>two</asp:ListItem>                     <asp:ListItem Value=”3″>three</asp:ListItem>                     <asp:ListItem Value=”4″>four</asp:ListItem>                 </asp:DropDownList>             </div>         </ItemTemplate> protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {     var chk = e.Row.FindControl(“CheckBox1”) as CheckBox;     if […]