Skip to main content

ASPxClientListEdit.SetSelectedItem(item) Method

Sets the list editor’s selected item.

#Declaration

TypeScript
SetSelectedItem(
    item: ASPxClientListEditItem
): void

#Parameters

Name Type Description
item ASPxClientListEditItem

An ASPxClientListEditItem object that specifies the item to select.

#Remarks

Use the SetSelectedItem method on the client side to specify the selected item within the list editor. If a null value is passed as the parameter, no item will be selected within the editor.

#Example

<dx:ASPxListBox ID="ASPxListBox1" runat="server" ClientInstanceName="listBox" >
    <Items>
        <dx:ListEditItem Text="Item 10" Value="10" />
        <dx:ListEditItem Text="Item 20" Value="20" />
        <dx:ListEditItem Text="Item 30" Value="30" />
        <dx:ListEditItem Text="Item 40" Value="40" />
    </Items>
</dx:ASPxListBox>

<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Select Item" AutoPostBack="False">
    <ClientSideEvents Click="function(s, e) {
        var item = listBox.FindItemByValue('20');
        listBox.SetSelectedItem(item);
    }" />
</dx:ASPxButton>
See Also