I have been having problems referencing controls in the WebHierarchicalDataGrid when using Custom Template Paging. I want to do the same thing with the Hierarchicalwebdatagrid as in the custom paging example for the webdatagrid.
To reproduce the error simple edit the webdatagrid example and change the <ig:webdatagrid tags to <ig:WebHierarchicalDataGrid
This will error with Object reference not set to an instance of an object
Line 21: pagerControl = WebDataGridView.Behaviors.Paging.PagerTemplateContainer.FindControl("CustomerPager") as WebFeatureBrowser_WebDataGrid_Paging_CustomerPagerControl;Line 22: pagerControl.PageChanged += new EventHandler<PageChangedEventArgs>(currentPageControl_PageChanged);The FindControl method cannot find the CustomerPager control. if I debug this I can see that the control count in the footer template is 0.
I also found that PagerTemplateContainer.was deprecated and in my examples was replaces with PagerTemplateContainerBottom
Greg
Hi GregSharp,
It has been a while since your post, however in case you still need assistance I would be glad to help.
In this particular example you can access the user control inside the template using:
UserControl control = (UserControl)(WebHierarchicalDataGrid1.GridView.Behaviors.Paging.PagerTemplateContainerBottom).FindControl("CustomerPager");
Please let me know if you have any questions.
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://www.infragistics.com/support
In the example on:http://www.infragistics.com/samples/aspnet/data-grid/paging-custom-pager-template
How would you then go about referencing the PageChanged method? Since it is cast as a UserControl and not a CustomerPagerControl?
Thanks!
For completeness:
Using WebHierarchicalDataGridName.Behaviors.Paging.PagerTemplateBontainerBottom.FindControl("CustomerPager") returns NULL.... BUT using:
UserControl control = (UserControl)(WebHierarchicalDataGrid1.GridView.Behaviors.Paging.PagerTemplateContainerBottom).FindControl("CustomerPager") returns the custom control, but it has a "Type" of ASP.customerpagercontrol_ascx. My application fails when trying to cast that into the CustomerPagerControl type.
Why can't the control be found using the first method? How can I expose the methods defined in CustomerPagerControl since a type of "UserControl" doesn't have those methods defined like the extended class CustomerPagerControl.
Thanks!Adam
http://www.infragistics.com/community/forums/t/43171.aspx
This is really the same issue, it explains it well, and it makes more sense now, that the WebHierarchicalDataGrid holds multiple Grids, so you need to reference GridView.Behaviors.Paging.PagerTempalteContainerBottom.FindControl, however this is still returning null when I try to create it like the example above (as a type of CustomerPagerControl). But if I declare it as a UserControl, it finds the control and assigns it a value (again with a type of ASP.customerpagercontrol_ascx)
How can I work around this?
Adam
http://help.infragistics.com/Help/Doc/ASPNET/2011.2/CLR4.0/html/WebHierarchicalDataGrid_Paging_Template.html
Again for completeness (in case anyone else has this issue with the example listed in my previous comment) it looks like THIS example shows how to do this a bit differently.
I was hoping to avoid using any more js than I need to write, but it looks like this is a more viable solution.
However, can I still get clarification on why the mehtod of using a UserControl will not work?
Any insight would be greatly appreciated!
Also I haven't mentioned yet but I am using release 14.1 ASP.NET :) Thanks again!