Server Side Events

8 Aug 20172 minutes to read

The following server side event is available in Listbox control.

Event Event Description Event Description
OnCheckChange Occurs when CheckBox value is changed. Event Argument contains the following parameters.e.IsChecked – Status of Listbox Checkbox.e.Text – Text of Listbox Selected item.e.Value – Value of Listbox Selected item.e.SelectedText –Text of Listbox Selected item.e.ItemId – Index Value of Listbox Selected item.e.EventType – Event Name.Arguments – Contain keys and values for SelectedText and Args.
OnValueSelect Occurs when Listbox Active Node is changed Event Argument contains the following parameters.e.IsChecked – Status of Listbox Checkbox.e.Text – Text of Listbox Selected item.e.Value – Value of Listbox Selected item.e.SelectedText –Text of Listbox Selected item.e.ItemId – Index Value of Listbox Selected item.e.EventType – Event Name.Arguments – Contain keys and values for SelectedText and Args.
OnIndexChanged Occurs when selected list item Index is Change. Event Argument contains the following parameters.e.IsChecked – Status of Listbox Checkbox.e.Text – Text of Listbox Selected item.e.Value – Value of Listbox Selected item.e.SelectedText –Text of Listbox Selected item.e.ItemId – Index Value of Listbox Selected item.e.EventType – Event Name.Arguments – Contain keys and values for SelectedText and Args.

In an ASPX page, add the Listbox control to configure Listbox events.

  • HTML
  • <%--Add serverside event for ListBox control as follows--%>
    
    <ej:ListBox ID="listBoxSample" DataTextField="CustomerID" OnValueSelect="listBoxSample_CheckChange" runat="server">
    
    </ej:ListBox>

    The following code example define listbox sample _ValueSelect server side event in behind.

  • C#
  • // Add the code in C Sharp page
    
    
    
        protected void Page_Load(object sender, EventArgs e)
    
        {
    
            this.listBoxSample.DataSource = "http://mvc.syncfusion.com/Services/Northwnd.svc/";
    
            this.listBoxSample.Query = "ej.Query().from('Customers')";
    
        }
    
        protected void listBoxSample_CheckChange(object sender, Syncfusion.JavaScript.Web.ListBoxEventArgs e)
    
        {
    
            //e.IsChecked – Status of Checkbox
    
            //e.EventType – Event Name
    
            //e.Arguments – Contain keys and values for SelectedText and Args
    
            //e.Text – Text value of selected node
    
            //e.Value – Value of selected node
    
            //e.SelectedText – Text  of selected node
    
            //e.ItemId – Index value of selected node
    
    
    
        }