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

can i access CommanItemTemplate in RadGrid Need dataSource event.

3 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prasad
Top achievements
Rank 1
Prasad asked on 18 Dec 2012, 09:57 AM
Hi ,

I placed an user control in radgrid CommandItemtemplate. I have to access and get the reference of this User Control in Need DataSource. Is it possible ?

Regards,

Prasad

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Dec 2012, 10:10 AM
Hi,

You can reference controls in ItemDataBound event as shown below.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridCommandItem)
        {
            GridCommandItem item = (GridCommandItem)e.Item;
            WebUserControl ctl = (WebUserControl)item.FindControl("WebUserControl1");
        }
    }

Thanks,
Princy.
0
Prasad
Top achievements
Rank 1
answered on 18 Dec 2012, 10:26 AM
Hi Princy,

Thanks for your replay !. But i need to access User Control in radgrid_NeedDataSource event ....
0
Princy
Top achievements
Rank 2
answered on 19 Dec 2012, 05:24 AM
Hi,

NeedDataSource event is too early to get reference of the controls. .You can access controls in ItemDataBound or ItemCreated event.
Check the following help documentation which explains event sequence of radgrid.
Event sequence

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