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
230
Hierarchical WebGrid from 1 underlying select statement
posted

Hi guys, I am wondering if it would be possible to create a single DataTable and then use some sort of "grouping" functionality to create a hierarchy suitable for the grid.  Basically right now I create multiple stored procedures that populate data tables, and then I create a relationship between the tables and bind them to the grid.  I am wondering if I could just write one stored procedure with a larger join based select statement that will give me a flat representation of the hierarchy, then somehow define the grouping and bind it to the gird.  I believe this is how MS Reporting Services works, where I can define the "grouping" columns from within a single source, in essence producing a hierarchy.  I'm using 7.2 controls if that matters.  What I am trying to accomplish is having less stored procedures, especially specialized procedures that will likely never be used outside of my screen.  If all fails I think I can just go the multiple select statements in one procedure route as well.  All and any ideas are welcome!

Thanks,

Alex
  • 640
    posted

    Not really what you're asking for, but...

    You could pull back a big, honkin' datareader from a single proc, then loop through and build datatables from it, then add them to a dataset and slap in a relation and bind it.

     I'm not sure it's worth the effort to do this though. 

  • 8680
    posted

    My advice would be to stick with what's already working, but what do I know... ;-)  WebGrids seem to have a special fondness for multi-table DataSets.

    But you should be able to tweak your column.AllowGroupBy and column.IsGroupByColumn properties to get what you want.