Wednesday, March 28, 2012

Accessing gridview inside Accordion Control

Hello Guys,

I am trying to access the gridview control that is inside the accordion control.

// Filling Pending Grid - Does not work
aFileInfo = fHandle.GetFiles("Pending","*.dat");
PendingGrid.DataSource = aFileInfo;
PendingGrid.DataBind();
This code doesnt work.

I had to replace it with the following code in order to make it work:

((GridView)this.MyAccordion.Panes[0].FindControl("PendingGrid")).DataSource = aFileInfo;
((GridView)this.MyAccordion.Panes[0].FindControl("PendingGrid")).DataBind();

any idea why i cant directly access the Gridview using its ID directly?

Thanks in advance

I think this has to do with the AccordionControl being a templated control, and that's just how they work.

No comments:

Post a Comment