我有一个可折叠的面板扩展器。我对扩展器没有任何问题。但是,我有一个打开面板的链接,我想要另一个链接说折叠来关闭它。我想隐藏一个显示一个 javascript 端。问题是它只适用于第一行,而不适用于其他行,因为我没有得到唯一的 ID 或其他东西。我还没有找到一个合理的答案。我通过获取父元素尝试了 jquery,但没有成功。我能做些什么?
回答:
<asp:TemplateField HeaderText="Lng Descr" SortExpression="LongDescription">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("LongDescription") %>' TextMode ="MultiLine" Rows="5" ></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<table>
<tr id="expand" style="display:">
<td>
<asp:Label ID="Label3" runat="server" ForeColor="Blue"><u></u></asp:Label>
</td>
</tr>
</table>
<asp:Panel ID="Panel1" runat="server" >
<table>
<tr>
<td>
<%#Eval("LongDescription")%>
</td>
</tr>
</table>
</asp:Panel>
<ajaxToolkit:CollapsiblePanelExtender ID="cpe" runat="Server"
TargetControlID = "Panel1"
CollapsedSize="0"
ExpandedSize="50"
Collapsed="true"
ExpandControlID="Label3"
CollapseControlID="Label3"
AutoCollapse="false"
Scrollcontents="false"
collapsedText="<u>Expand"
ExpandDirection="Vertical"
ExpandedText = "<u>Collapse"
TextLabelID="Label3" />
</ItemTemplate>
</asp:TemplateField>