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

Populate ComboBox inside FormTemplate

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott Durrett
Top achievements
Rank 1
Scott Durrett asked on 06 May 2010, 02:44 PM

I would like to populate the combo boxes on my edit FormTemplate on Page_Load.  Is this possible or do I have to do it on item created event?  I would like to do it once versus re-populating the control every time the user clicks "edit".

Thanks
Scott

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 May 2010, 05:23 AM

Hello Scott,

A better approach would be accessing the RadComboBox in ItemDataBound event of grid and populate the control.

C#:

 
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)  
        {  
            //the item is in edit mode  
            GridEditFormItem editedItem = e.Item as GridEditFormItem;  
            RadComboBox combo = (RadComboBox)editedItem.FindControl("RadComboBox1");  
            // Populate the combo  
        }  
    } 

-Shinu.

Tags
Grid
Asked by
Scott Durrett
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or