Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
995
where exactly should I bind my webgrid in hierarchical mode
posted

Hello,

I have been reading all the post an example about hierarchical webgrid.
However, you guys are always using a different method to bind the grid
So what is the most efficient way to bind my hierachical webgrid? (ondatabinding event? page_onload? initializedatasource?)

Keep in mind that I want to do update,insert and delete in my webgrid. By the way, other than the WHDS, you guys did not find any other way to handle CRUD activity more efficiently? I have to write way more code than with the CLR 1.0 to get the CRUD working. The WHDS still has some bug so I have to do it manualy. So if you have any better method please let me know.

Thanks and merry christmas

Parents
  • 45049
    posted

    The "most efficient way" is .... it depends.  It depends greatly on the type of object you're using for your grid's data source, the nature of the data it contains, and the grid options you're using.

    For my personal usage, unless I have a specific reason to do otherwise, I use one of two approaches.  One is to assign a data source at design time, such as when I'm using an ASP.NET DataSource control (SqlDataSource, WebHierarchicalDataSource, and so on).  If I'm binding to an object in code, I prefer using InitializeDataSource.  With either approach, I can easily turn on the grid's AJAX functionality without making significant code changes.

    For hierarchical data, if you want to bind at design-time, then WebHierarchicalDataSource is your only viable approach; most of the other ASP.NET DataSource controls (including SqlDataSource and ObjectDataSource) can't handle a hierarchy.  If you want to bind in code, you can use the UpdateRow and DeleteRow events (or their batch equivalents) to update your data object, in the same way that was required in a CLR 1.x application.

Reply Children