开发者

Devexpress controls clear selection?

I have the DevExpress controls within update panel and I need to clear selection on all of them from server side. Like DdlDropDownList.Clear开发者_如何学编程Selection(); but in DevExpress simple actions are handled differently.

ASPxComboBox

ASPxDateEdit

ASPxTextBox

Does anyone know the best implementation of required functionality.


Try setting the Value property of those controls to null.

DdlDropDownList.Value = null;

Here's the documentation for those 3 controls:

http://documentation.devexpress.com/#AspNet/clsDevExpressWebASPxEditorsASPxComboBoxtopic
http://documentation.devexpress.com/#AspNet/clsDevExpressWebASPxEditorsASPxDateEdittopic
http://documentation.devexpress.com/#AspNet/clsDevExpressWebASPxEditorsASPxTextBoxtopic

Here's a sample that worked for me with version 9.2. The "Clears" button clears the editor while the "Doesn't Clear" button doesn't.

<dxe:ASPxComboBox ID="a" runat="server" ValueType="System.String">
    <Items>
        <dxe:ListEditItem Text="1" Value="1" />
        <dxe:ListEditItem Text="2" Value="2" />
        <dxe:ListEditItem Text="3" Value="3" />
    </Items>
</dxe:ASPxComboBox>
<dxe:ASPxDateEdit ID="b" runat="server" />
<dxe:ASPxTextBox ID="c" runat="server" Width="170px" />
<asp:Button runat="server" Text="Clears" OnClick="Button1_Click" />
<asp:Button runat="server" Text="Doesn't Clear" />

protected void Button1_Click(object sender, EventArgs e)
{
    a.Value = null;
    b.Value = null;
    c.Value = null;
}


DdlDropDownList.Items.Clear(); or DdlDropDownList.Text = string.empty;
someDateEdit.Text = string.empty;
someTextBox.Text = string.empty;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜