Grid EditFormType

2 posts, 0 answers
  1. Amol
    Amol avatar
    57 posts
    Member since:
    Apr 2008

    Posted 10 Nov 2008 Link to this post

    HI Team,

    I am using the grid with EditFormType="Template"  .
    and in FormTemplate i am using the rad combox .
    while editing the record i need to fill that combo from the database .
    i tried it on the itemCommad event of grid , how ever i didn't get the control by using the findcontrol method.

            GridEditFormItem formItem = (e.Item as GridDataItem).EditFormItem as GridEditFormItem;
            RadComboBox box = (formItem.FindControl("drpQType") as RadComboBox).Text;
    it returns null reference for the combobox.
    plz help me for this issue.

  2. Daniel
    Daniel avatar
    4949 posts

    Posted 10 Nov 2008 Link to this post

    Hello Amol,

    Could you please try the following approach?
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
        GridEditFormItem item = e.Item as GridEditFormItem; 
        if (item != null && item.IsInEditMode) 
            RadComboBox box = item.FindControl("drpQType"as RadComboBox; 
            string myText = box.SelectedValue; 

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products. 
Back to Top