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

Can't use radgrid event when in radpanelitem

1 Answer 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kel Way
Top achievements
Rank 1
Kel Way asked on 11 Aug 2008, 03:05 PM

If I have radpanel control and am using radgrid inside a radpanelitem, I have to reference the radgrid as such, to get a reference:

Telerik.Web.UI.

RadGrid gvSiteRef = (Telerik.Web.UI.RadGrid)RadPanelBar1.FindItemByValue(PANEL_SITE_HEADER).FindControl("gvSite");

That is correct right???

So, how do I use grid events now since 'eventargs' param won't work since I can't directly reference the grid anymore (since its in a radpanel)?:
protected

void gvSite_ColumnCreated(object sender, gvSiteColumnCreatedEventArgs e)

{

.....

}

Thanks for help..

1 Answer, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 14 Aug 2008, 11:15 AM
Hello Kel,

Indeed, in such a situation, locating the control is not as straightforward- this is because the grid is nested in a different naming container.
The control's events, however, are the same. For example, if you have a grid, located as:

.cs
 protected void Page_Load(object sender, EventArgs e)  
    {  
        RadGrid rg1 = (RadGrid)Panel1.Controls[0].Controls[1];  
            } 

you can assign an event to it, as normally:

rg1.ItemDataBound += new GridItemEventHandler(RadGrid1_ItemDataBound);  
 

the signature of the event handler routine will be the same:

 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
 
    } 

I hope this information helps.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Kel Way
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or