Tuesday, 17 April 2012

Teleric Radcontrol Combobox on SelectedIndexChanged

The SelectedIndexChanged event occurs when the user selects a new item in the drop-down list.

The SelectedIndexChanged event does not fire unless the AutoPostBack property is True.

The SelectedIndexChanged event handler receives two arguments:
  1. The RadComboBox that is loading items. This argument is of type object, but can be cast to the RadComboBox type.
  2. An EventArgs object. This object has the following properties for identifying what has changed:
    • Text is the text of the item that was just selected.
    • Value is the value of the item that was just selected.
    • OldText is the text of the item that was previously selected
    • OldValue is the value of the item that was previously selected
Use the SelectedIndexChanged event handler to respond in server-side code when the user changes the current selection:
  
ASPX code:
<telerik:radcombobox 
  id="RadComboBox1" 
    runat="server" 
    autopostback="True" 
    onselectedindexchanged="RadComboBox1_SelectedIndexChanged">
</telerik:radcombobox>

C# code behind:
private void RadComboBox1_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    Label1.Text = "You selected " + e.Text + " item";
}
 

No comments:

SQL: Generate a range of numbers

SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n FROM       (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),      (VALU...