Search code examples
c#asp.netcomboboxtelerikradgrid

Index Change event for Combobox of gridtemplateColumn in Telerik


I can write a code. In this I can take a Template Column & in this I build a RadCombobox. When it's Index changed I want to affect the below text box. Link the selected value of the Combo box is set as Text on Below TextBox. Combo Box & Text Box are different Controls of Different Template Column.

I can Write Control of Combo box like this :

<telerik:RadComboBox ID="cmbGID" runat="server" DataSourceID="SqlDataSource8" DataTextField="Name"
                        DataValueField="ID" AutoPostBack="True" OnSelectedIndexChanged="cmbGID_SelectedIndexChanged">

But I don't know the parameters of this event like this :

protected void cmbGID_SelectedIndexChanged()
{
       //code...
}

Any one plz tell me that parameters & tell me is that possible to set txtValue.Text = cmbGID.SelectedValue.ToString()...???


Solution

  • I got the solution of this problem...

    This is working by following code :

    protected void cmbGrp_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        RadComboBox ddlCtrl = sender as RadComboBox;
        GridEditableItem dataItem = ddlCtrl.NamingContainer as GridEditableItem;
        RadComboBox cmbCtrl = dataItem.FindControl("cmbSetNo") as RadComboBox;
        RadTextBox txtCtrl = dataItem.FindControl("cmbSetNo") as RadTextBox;
        txtCtrl.Text = ddlctrl.SelectedValue.ToString();
    
        string query = "QUERY";
    
        ds.Clear();
        ds = c.getDataSet(query);
    
        cmbCtrl.DataSource = ds.Tables[0];
        cmbCtrl.DataTextField = "NO";
        cmbCtrl.DataValueField = "RecordID";
        cmbCtrl.DataBind();
    }