私はASP.NETを使用しています。チェックボックス要素を持つグリッドビューがあります。チェックボックスがチェックされているかどうかを確認したい背景色を黒に変更できる最も近いtdにクラスを追加します
私はこれを使用しますが、動作しません:
Js ((テイスティングの目的)) :
$(document).ready(function () {
$(":CheckBox").closest('td').addClass("OnSelectTr");
});
CSS :
.OnSelectTr
{
background-color:Black;
}
ASP.NET コード:
<asp:GridView ID="DossierGV" runat="server" AllowPaging="True"
AllowSorting="True" DataSourceID="DossierPF" AutoGenerateColumns="False"
DataKeyNames="ID_Dossier">
<Columns>
<asp:TemplateField HeaderText="Choisir">
<EditItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ID_Dossier" HeaderText="ID_Dossier" ReadOnly="True"
SortExpression="ID_Dossier" />
<asp:BoundField DataField="ID_Entreprise" HeaderText="ID_Entreprise"
SortExpression="ID_Entreprise" />
<asp:BoundField DataField="Date_Depot" HeaderText="Date_Depot"
SortExpression="Date_Depot" />
<asp:BoundField DataField="Type_Etude" HeaderText="Type_Etude"
SortExpression="Type_Etude" />
<asp:BoundField DataField="Dernier_Type" HeaderText="Dernier_Type"
SortExpression="Dernier_Type" />
<asp:BoundField DataField="Eligibile" HeaderText="Eligibile"
SortExpression="Eligibile" />
<asp:BoundField DataField="Fiche_Information" HeaderText="Fiche_Information"
SortExpression="Fiche_Information" />
<asp:BoundField DataField="Buletin_Adhesion" HeaderText="Buletin_Adhesion"
SortExpression="Buletin_Adhesion" />
<asp:BoundField DataField="Fiche_Renseignment" HeaderText="Fiche_Renseignment"
SortExpression="Fiche_Renseignment" />
<asp:BoundField DataField="Attestation" HeaderText="Attestation"
SortExpression="Attestation" />
<asp:BoundField DataField="ID_Cabinet" HeaderText="ID_Cabinet"
SortExpression="ID_Cabinet" />
<asp:BoundField DataField="Montant_Demander" HeaderText="Montant_Demander"
SortExpression="Montant_Demander" />
<asp:BoundField DataField="Duree" HeaderText="Duree" SortExpression="Duree" />
<asp:BoundField DataField="Porcentage_Taux" HeaderText="Porcentage_Taux"
SortExpression="Porcentage_Taux" />
<asp:BoundField DataField="Nom_Giac" HeaderText="Nom_Giac"
SortExpression="Nom_Giac" />
</Columns>
</asp:GridView>
ナビゲーターのコードソース:
<div class="GridViewDiv">
<div id="Corps_DossierUpdatePanel">
<div>
<table cellspacing="0" rules="all" border="1" id="Corps_DossierGV" style="border-collapse:collapse;">
<tr>
<th scope="col">Choisir</th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$ID_Dossier')">ID_Dossier</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$ID_Entreprise')">ID_Entreprise</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Date_Depot')">Date_Depot</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Type_Etude')">Type_Etude</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Dernier_Type')">Dernier_Type</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Eligibile')">Eligibile</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Fiche_Information')">Fiche_Information</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Buletin_Adhesion')">Buletin_Adhesion</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Fiche_Renseignment')">Fiche_Renseignment</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Attestation')">Attestation</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$ID_Cabinet')">ID_Cabinet</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Montant_Demander')">Montant_Demander</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Duree')">Duree</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Porcentage_Taux')">Porcentage_Taux</a></th><th scope="col"><a href="javascript:__doPostBack('_ctl0$Corps$DossierGV','Sort$Nom_Giac')">Nom_Giac</a></th>
</tr><tr>
<td>
<input id="Corps_DossierGV_CheckBox1_0" type="checkbox" name="_ctl0:Corps:DossierGV:_ctl2:CheckBox1" />
</td><td>3</td><td>4</td><td>10/12/2011 00:00:00</td><td>DS</td><td>IN</td><td>oui</td><td>oui</td><td>oui</td><td>oui</td><td>oui</td><td>1</td><td>1000,00</td><td>10</td><td>70</td><td>GIAC1-IMME</td>
</tr>
</table>
</div>
</div>