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

Updating items inside of an edit template

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 06 Jul 2011, 10:59 PM
I'm sure the answer is out there, but my searches have not turned it up. Currently I have a RadGrid with a details table below it. Inside of that details table I have an EditFormsSettings.

<EditFormSettings EditFormType="Template">
    <FormTemplate>
        Select from combobox: <telerik:RadComboBox ID="ComboBox1" runat="server"
                    DataSourceID="edsSource" AutoPostBack="true"  
                           OnSelectedIndexChanged="ComboBox1_SelectedIndexChanged"
                    DataTextField="Name" DataValueField="Id" />
         <br />
         Label: <asp:Label ID="Label1" runat="server" />
    </FormTemplate>
</EditFormSettings>


Currently it loads fine, because I have the event on the main grid ItemDataBound look for a GridEditableItem and updates it appropriately. 

What I want to do is whenever the SelectedIndex Changes on the combo box, I want to update the label inside of that edit template. How can i do this?

Thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Jul 2011, 04:41 AM
Hello Derek,

Try the following code snippet to access the label in SelectedIndexChanged event.

C#:
protected void ComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
   {
       RadComboBox combo = sender as RadComboBox;
       GridEditableItem item = (GridEditableItem)combo.NamingContainer;
       Label lbl = (Label)item.FindControl("Label1");
       lbl.Text = combo.SelectedValue;
   }

Thanks,
Princy.
Tags
Grid
Asked by
Derek
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or