This is a migrated thread and some comments may be shown as answers.

Master / Detail RadGrid Data binding to DataSets

1 Answer 179 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Darshan
Top achievements
Rank 1
Darshan asked on 13 Mar 2009, 10:14 PM
Hello,

I've been working on a project where I need to present a two tier data structure in a grid ("Line Items" with "Charge Items" under them). I purchased the Telerik suite to help with this project. Requirements include.

- Pull data together from several tables in different databases
- Use this data for the grid and for other controls
- Write changes to a Changes table, rather than the source tables

Because of these requirements I decided to populate data into a DataSet instead of using a static SqlDataSource or something similar. Going through all the online examples and scenarios I decided that this one was closes to the one I want:
http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html
I chose this "Dynamically defining the structure of a statically-declared grid" scenario because the I can't declaratively bind to a staticly defined data source like a SqlDataSource.

The main difference is I need to bind to DataViews in a DataSet that was created during PageLoad and is persisted in the Session, rather than a declarative source such as a SqlDataSource, but I found that this changes / breaks many things compared to the Telerik example, including:

1. I have set EnableColumnsViewState = false, otherwise things fall apart. Is this bad? Does it hurt performance?
2. I had to implement the NeedDataSource and DetailTableDataBind events, automatic heirarchy does not work whether I do it in the ASPX or in code during Page_Load. This required me to back out all the code used to set the DataKeys and create the relationships as this does not appear to be used in a DetailTableDataBind scenario. Why?
3. I can only get it to work if I set it to AutoGenerateColumns! This is a serious problem, as I need to add some columns via code (I'd actually like to add all the columns programatically, as in the example, but this makes the example break down as soon as I expand the details)

Getting it to work at all required a lot of figuring out, and it's still not working the way I want it to. I also had to figure out the EnableColumnsViewState and the necessity of implementing NeedDataSource and  DetailTableDataBind. This information is scattered through many different articles and examples and some of it is just trial and error to discover.

My Questions are:

1. Is there a comprehensive example that covers dynamically defining the structure of a statically-declared grid, using a DataSet?
2. Is there a solution for item #3 above with using the Page_Load scenario, or do I need to move to the Page_Init scenario?

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 16 Mar 2009, 05:25 PM
Hello Darshan,

Please examine this code library devoted on the same matter.

Further information when EnableColumnViewState is set to "False" you can find here.

If any questions arise I will be glad to assist you additionally.

Regards, Georgi Krustev
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Darshan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or