我使用asp.net。我在页面上有3个嵌套的datalist。在内部datalist中,有ckeckbox。我看起来像下面。
我的dalist的设计如下:
<asp:DataList ID="grdRubrikKazanimlari" runat="server"
OnItemDataBound="grdRubrikKazanimlari_OnItemDataBound"
CssClass="grdRubrikKazanimlari" >
<ItemTemplate>
<div style="width:100%;display:block;">
<asp:Label ID="lblDegTipIliskiID" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "DegTipIliskiID")%>'></asp:Label>
<asp:Label ID="lblDegerlendirmeTipiID" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "DegerlendirmeTipiID")%>'></asp:Label>
<h1>
<asp:Label ID="lblDegerlendirmeTipi" runat="server" Text=""><%# DataBinder.Eval(Container.DataItem, "DegerlendirmeTipi")%></asp:Label>
</h1>
<asp:DataList ID="grdRubrikKazanimGrup" runat="server" OnItemDataBound="grdRubrikKazanimGrup_OnItemDataBound" CssClass="grdRubrikKazanimGrup">
<ItemTemplate>
<div style="width:96%;display:block;margin-left:5px;">
<asp:Label ID="lblAltGrupIliskiID" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "AltGrupIliskiID")%>'></asp:Label>
<h2>
<asp:Label ID="lblDegerlendirmeTipi" runat="server" Text=""><%# DataBinder.Eval(Container.DataItem, "AltGrup")%></asp:Label>
</h2>
<asp:DataList ID="grdRubrikKazanimlar" runat="server" OnItemDataBound="grdRubrikKazanimlar_OnItemDataBound" CssClass="grdRubrikKazanimlar" >
<HeaderTemplate>
<table style="width:100%;">
<tr style="line-height:25px;">
<td style="width:70%;text-align:left;padding-left:12px;font-weight:bold;">Kazanım Açıklaması</td>
<td style="width:15%;background-color:#91c98f;text-align:center">T.Edinilmiş</td>
<td style="width:15%;background-color:#bf6f86;text-align:center">T.Edinilmemiş</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblRubrikKazanimID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "RubrikKazanimID")%>' Visible="false"></asp:Label>
<table style="width:100%;" id="tblkazanim">
<tr style="height:50px;vertical-align:middle;">
<td style="width:70%;text-align:left;padding-left:12px;">
<li>
<asp:Label ID="lblDegerlendirmeTipi" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "KazanimAciklama")%>'></asp:Label>
</li>
</td>
<td style="width:15%;background-color:#91c98f;text-align:center;vertical-align:middle;">
<asp:CheckBox ID="chkSeciliMi" runat="server" align="center" CssClass="chsecili" OnCheckedChanged="chkSeciliMi_CheckChanged" AutoPostBack="true" />
</td>
<td style="width:15%;background-color:#bf6f86;text-align:center;vertical-align:middle;">
<asp:CheckBox ID="chkYarimSeciliMi" runat="server" AutoPostBack="true" OnCheckedChanged="chkYarimSeciliMi_CheckChanged" CssClass="chkYarimSeciliMi"/>
</td>
</tr>
</table>
<div style="width:96%;display:block;">
<asp:Label ID="lblDegTipIliskiID" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="lblDegerlendirmeTipiID" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="lblKazanimDegerlendirmeTipiID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DegTipIliskiID")%>' Visible="false"></asp:Label>
<asp:Label ID="lblKazanimSirasi" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Sirasi")%>' Visible="false"></asp:Label>
</div>
</ItemTemplate>
</asp:DataList>
</div>
</ItemTemplate>
</asp:DataList>
</div>
</ItemTemplate>
</asp:DataList>
我希望用户只检查水平线上的复选框。我怎么能用jquery做到这一点。 感谢。
答案 0 :(得分:0)
http://api.jquery.com/checked-selector/
这应该可以解决问题:)
如果需要,将它与.each结合使用:)
如果只需要水平检查,则应该向这些复选框添加类,以确保只获得特定的复选框。 (如.row1 .row2等)