Is it possible to target three specific columns using jQuery or CSS, like this:
Take a look at the example code below:
<script> //I am attempting to target specific columns with this code snippet
$('GvGrid').slice(1, 3).css("backgroundColor", "yellow");
//$("GvGrid td:nth-child(13):gt(1)").css("backgroundColor", "yellow");
</script>
<table id="TblCom" runat="server" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:GridView ID="Gv" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" RowStyle-CssClass="GvGrid" CellPadding="1">
<HeaderStyle CssClass="GvGrid" HorizontalAlign="Center" />
<Columns>
<asp:BoundField DataField="MES_ANIO" HeaderText="MONTH"></asp:BoundField>
<asp:BoundField DataField="PERIOD" HeaderText="PERIOD"></asp:BoundField>
<asp:HyperLinkField DataNavigateUrlFields="CVE_USUARIO" HeaderText="USER" DataNavigateUrlFormatString="/Sales/RepPersonalAuxiliaryFile.aspx?prospect={0}" DataTextField="USER"> //Target this
<ControlStyle CssClass="Text" />
<ControlStyle CssClass="Text" />
</asp:HyperLinkField>
<asp:HyperLinkField DataNavigateUrlFields="" DataNavigateUrlFormatString="/Controller/Payroll/CommissionsDetail.aspx?StartDate={0:d}&EndDate={1:d}&UserKey={2}&RoleKey={3}&ProductType=ECO&Status={4}&Total={5}&Paid={6}&LocationKey={7}&QuincenaType={8}" DataTextField="ECO" DataTextFormatString="{0:###}" HeaderText="ECO"> //Target this
</asp:HyperLinkField>
<asp:HyperLinkField DataNavigateUrlFields="" DataNavigateUrlFormatString="/Controller/Payroll/CommissionsDetail.aspx?StartDate={0:d}&EndDate={1:d}&UserKey={2}&RoleKey={3}&ProductType=A&Status={4}&Total={5}&Paid={6}&LocationKey={7}&QuincenaType={8}" DataTextField="A" DataTextFormatString="{0:###}" HeaderText="A">
</asp:HyperLinkField>
<asp:HyperLinkField DataNavigateUrlFields="" DataNavigateUrlFormatString="/Controller/Payroll/CommissionsDetail.aspx?StartDate={0:d}&EndDate={1:d}&UserKey={2}&RoleKey={3}&ProductType=B1&Status={4}&Total={5}&Paid={6}&LocationKey={7}&QuincenaType={8}" DataTextField="B1" DataTextFormatString="{0:###}" HeaderText="B1"> //Target this </asp:HyperLinkField>
</Columns>
</asp:GridView>
<br />
</td>
</tr>
</table>
My page Inherits from a master page, and the script above is trying to target specific columns, but the styling is not visible when the page loads. Any feedback would be appreciated. Thank you.