Monday, March 26, 2012

How do I extend a DataGrid/DataList for ATLAS behavior?

I have two inherited DataGrid and DataList classes that render a paged grid and list with some enhanced behaviors (better pagers and retreiving only items that are shown with NHibernate). I would like paging not to refresh the page.

It's easy with an UpdatePanel: add a panel, add an event OnDataBinding( ) and Update the panel. For my project (www.foodcandy.com) this means updating a hundred grids and lists.

So instead I would like to build the panel behavior into the actual DataGrid and DataList and have all my grids behave this way. The first easy thing is to add a panel property and tell the grid/list that it's inside an update panel. But I still have to modify a 100 pages to add the update panels.

How do I do something like that?

Thx
dB.

hello.

maybe building a usercontrol will be the faster way to get what you want...though i still think that i'd add the panel to all the pages..


I doubt it will be faster Luis - this is a datagrid, I would need to expose all the methods for various properties like PagerStyle and I am not even sure what to do with ItemTemplates. No?

hello.

well, i was thinking in adding a property to the usercontrol that lets you get a reference to the datagrid.


Luis Abreu:

well, i was thinking in adding a property to the usercontrol that lets you get a reference to the datagrid.

I haven't tried this, but can you nest this in the aspx pages by having MyUserControl expose the DataGrid member?

<MyUserControl>
<DataGrid>
<TemplateColumn ... />
</DataGrid>
<MyUserControl>

No comments:

Post a Comment