ASPxClientButton.SetText(value) Method
Sets the text to be displayed within the button.
Declaration
SetText(
value: string
): void
Parameters
Name |
Type |
Description |
value |
string |
A string value specifying the text to be displayed within the button.
|
Note
- If the ASPxButton.Text property is empty and a button image is specified, a text element markup is not rendered. In this case, it is impossible to set a text on the client side using the SetText method.
- The SetText method does not HTML encode the specified text.
Example
The complete sample project is available in the DevExpress Code Central database at E143.
function OnExpandCollapseButtonClick(s, e) {
var isVisible = ContentPanel.GetClientVisible();
s.SetText(isVisible ? "+" : "-");
ContentPanel.SetClientVisible(!isVisible);
}
...
<dxe:ASPxButton ID="btnShowHide" runat="server"
Text="Show / Hide" AllowFocus="False" AutoPostBack="False">
<ClientSideEvents Click="function(s, e)
{ RoundPanel.SetClientVisible(!RoundPanel.GetClientVisible()); }" />
</dxe:ASPxButton>
<br/>
<dxrp:ASPxRoundPanel ID="rpRoundPanel" runat="server" Width="200px"
ClientInstanceName="RoundPanel" HorizontalAlign="Justify">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td style="white-space: nowrap;">
Collapsible Round Panel
</td>
<td style="width: 1%; padding-left: 5px;">
<dxe:ASPxButton ID="btnExpandCollapse" runat="server" Text="-"
AllowFocus="False" AutoPostBack="False" Width="20px">
<Paddings Padding="1px" />
<FocusRectPaddings Padding="0" />
<ClientSideEvents Click="OnExpandCollapseButtonClick" />
</dxe:ASPxButton>
</td>
</tr>
</table>
</HeaderTemplate>
<PanelCollection>
<dxp:PanelContent runat="server">
<dxp:ASPxPanel ID="pnlContent" runat="server" Width="100%"
ClientInstanceName="ContentPanel">
<PanelCollection>
<dxp:PanelContent runat="server">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Morbi vel ante congue ligula
blandit rhoncus. Mauris tellus augue, viverra euismod,
facilisis at, vestibulum sed, risus.
Vivamus lobortis ultricies erat.
</dxp:PanelContent>
</PanelCollection>
</dxp:ASPxPanel>
</dxp:PanelContent>
</PanelCollection>
</dxrp:ASPxRoundPanel>
...
See Also