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

Setting the Datasource in a radgrid's UserControl

1 Answer 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 09 Sep 2008, 05:07 PM
Hello,

In a radgrid I use a user control for inserts/updates.

The user control has dropdowns that have datasources that get set during the usercontrol's page_load.  

However, I need to change the datasource of these dropdowns in the user control when the radgrid is in edit mode vs insert mode.

AND

this datasource needs needs to be set BEFORE databinding takes place in the user control. 

How does your control meet this requirement?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Sep 2008, 09:15 AM
Hi,

You can access and set the datasource of the dropdownlist in the ItemCreated event and  identify the edit and insert modes  accordingly.

if(e.Item is GridEditFormItem && e.Item.IsInEditMode) // edit
{
    //
}
if(e.Item is GridEditFormInsertItem) // insert
{
    //
}


Thanks,
Shinu
Tags
Grid
Asked by
john
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or