在asp.net可折叠面板展开或折叠时更改按钮文本
我正在使用按钮显示/隐藏asp可折叠面板。当面板折叠时,如何将按钮文本更改为在asp.net可折叠面板展开或折叠时更改按钮文本,asp.net,ajax,ajaxcontroltoolkit,Asp.net,Ajax,Ajaxcontroltoolkit,我正在使用按钮显示/隐藏asp可折叠面板。当面板折叠时,如何将按钮文本更改为显示;当面板展开时,如何将按钮文本更改为隐藏 我尝试使用TextLabelID=“btnShowHideRequestComment”CollapsedText=“Show”ExpandedText=“Hide”,但没有成功 <asp:Panel ID="pnlRequestCommentHistory" runat="server"> <asp:GridView ID="gvwRequ
显示
;当面板展开时,如何将按钮文本更改为隐藏
我尝试使用TextLabelID=“btnShowHideRequestComment”CollapsedText=“Show”ExpandedText=“Hide”
,但没有成功
<asp:Panel ID="pnlRequestCommentHistory" runat="server">
<asp:GridView ID="gvwRequestCommentHistory" runat="server"
AutoGenerateColumns="False" CssClass="GridStyle"
DataSourceID="odsRequestCommentHistory">
<Columns>
<asp:BoundField DataField="Name" HeaderText="User" SortExpression="Name" />
<asp:BoundField DataField="CommentDate" HeaderText="Date"
SortExpression="CommentDate" />
<asp:BoundField DataField="Comment" HeaderText="Comment"
SortExpression="Comment" />
</Columns>
<AlternatingRowStyle CssClass="GridAlternateRowStyle" />
<RowStyle CssClass="GridRowStyle" />
</asp:GridView>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="cpeRequestCommentHistory" runat="server"
TargetControlID="pnlRequestCommentHistory" CollapseControlID="btnShowHideRequestComment" ExpandControlID="btnShowHideRequestComment"
Collapsed="true" CollapsedSize="0" TextLabelID="btnShowHideRequestComment" CollapsedText="Show" ExpandedText="Hide">
</asp:CollapsiblePanelExtender>
我从以下地址找到了解决方案:
protected void btnShowHideRequestComment_Click(object sender, EventArgs e)
{
if (IsPostBack)
{
if (btnShowHideRequestComment.Text == "Show")
btnShowHideRequestComment.Text = "Hide";
else
btnShowHideRequestComment.Text = "Show";
}
}