This is a migrated thread and some comments may be shown as answers.

[Solved] Related Combobox?

1 Answer 128 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Patrick Wilson
Top achievements
Rank 1
Patrick Wilson asked on 07 Oct 2009, 09:12 PM
Wanting to implement a simple related combobox inside the insert/edit mode of a radgrid. I would like for the user to select a value from the first field (a combobox) which will populate the next field which is a textbox.

Pwilson

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Oct 2009, 03:41 AM
Hello Patrick,

You can try out the following code to access the textbox in the edit row on changing the selection in a RadComboBox in the same edit row:
aspx:
<telerik:GridTemplateColumn DataField="FirstName" UniqueName="TemplateColumn" > 
     <ItemTemplate> 
      ....                 
     </ItemTemplate> 
     <EditItemTemplate> 
         <telerik:RadComboBox ID="RadComboBox1" AutoPostBack="true" DataSourceID="SqlDataSource1" DataTextField="FirstName" runat="server" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">      </telerik:RadComboBox> 
     </EditItemTemplate> 
</telerik:GridTemplateColumn> 
<telerik:GridBoundColumn DataField="FirstName" HeaderText="BoundColumn" UniqueName="BoundColumnUniqueName"
</telerik:GridBoundColumn> 

c#:
protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) 
    { 
        RadComboBox combo = (RadComboBox)o; 
        GridEditableItem editItem = (GridEditableItem)combo.NamingContainer; 
        TextBox txtbx = (TextBox)editItem["BoundColumnUniqueName"].Controls[0]; 
        txtbx.Text = combo.SelectedItem.Text; 
 
    } 

Thanks
Princy.
Tags
ComboBox
Asked by
Patrick Wilson
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or