我在gridview中有一个面板。当我单击网格视图中的单选按钮时,我调用click
单选按钮的 jquery 事件。那部分工作正常......现在我需要引用我的gridview内的面板,但我不能使用$this
,因为它指的是我的单选按钮列表(我认为它确实如此)。
我怎样才能得到这个面板的参考。
$("#MainContent_gvLineItems input[id*='rbAnswer']").click(function () {
var p = $(this).find('[id$=MainContent_gvLineItems_pnlAnswer]'); // find the panel but this wont work so what can I do here?
});
我不知道我的语法是否适合id$=MainContent_gvLineItems_pnlAnswer
网格视图中每一行的面板 ID 更改...
编辑
这是一些网格视图:
<asp:TemplateField HeaderText="Answer">
<ItemTemplate>
<div id="dMainAnswer">
<asp:RadioButtonList ToolTip="Please provide an answer to the method." RepeatDirection="Horizontal" ID="rbAnswer" runat="server" SelectedValue='<%# DataBinder.Eval(Container, "DataItem.AnswerID")%>'>
<asp:ListItem Text="Yes" Value="Yes" style="color:green;"></asp:ListItem>
<asp:ListItem Text="No" Value="No" style="color:red;"></asp:ListItem>
<asp:ListItem Text="N/A" Value="N/A" style="color:gray;"></asp:ListItem>
<asp:ListItem Value="" Text="" style="display: none" />
</asp:RadioButtonList>
<asp:Panel ID="pnlAnswer" runat="server" Visible="False">
<div id="dMainAnswerResponsibleType">
<asp:RadioButtonList ID="rbRespType" ToolTip="Select responsible contact type." runat="server" RepeatDirection="Horizontal" AutoPostBack="true" SelectedValue='<%# DataBinder.Eval(Container, "DataItem.ResponsiblePartyType")%>' OnSelectedIndexChanged="rbRespType_SelectedIndexChanged">
<asp:ListItem Selected="True" Text="TKSE" Value="TKSE">TKSE</asp:ListItem>
<asp:ListItem Text="Other" Value="Other">Other</asp:ListItem>
<asp:ListItem Value="" Text="" style="display: none" />
</asp:RadioButtonList>
</div>
<div id="dMainAnswerResponsible"><a href="#" onclick="return false;" class="info">Res:<span>Select who is responsible in resolving this issue.</span></a>
<asp:DropDownList ID="ddlEmployees" runat="server"
DataSource="<%# GetEmployees() %>" SelectedValue='<%# Eval("TKSEContact") %>' DataTextField="FullName" Width="75px"
DataValueField="FullName"
ToolTip="Select the TKSE responsible party.">
</asp:DropDownList>
<asp:TextBox ID="txtContact" Text='<%# Eval("ResponsiblePartyContact") %>' Width="75px" MaxLength="50" runat="server" ToolTip="Enter the responsible contact name." Visible="false"></asp:TextBox>
</div>
<div id="dDueDate"><a href="#" onclick="return false;" class="info">Due:<span>Select the due date when you expect this issue to be resolved.</span></a>
<asp:TextBox ID="txtDueDate" Text='<%# Eval("DueDate") %>' Width="59px" runat="server" ToolTip="Select the due date." CssClass="datePickerDueDate"></asp:TextBox>
</div>
<div id="cSendToSugar">
<asp:CheckBox ID="chkSendToSugar" ToolTip="Send/Update issue to Sugar?" BackColor="Gold" Text="Send To Sugar?" Checked="true" runat="server" />
</div>
</asp:Panel>
</div>
</ItemTemplate>
<FooterStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
注意面板pnlAnswer
,它最初设置为不可见Visible=False
。它也不是单选按钮列表的兄弟……至少我不认为它是……