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

feature question - multiple datasources in one grid?

1 Answer 55 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Asti
Top achievements
Rank 1
Asti asked on 14 Jul 2008, 10:32 AM
Hello,

this is a posting about experience with a grid problem and i'd like to know if it could be handled better with Grid for Asp.net Ajax

Recently, i had a cusomer request, where i needed to present tabular data, but the data was twofold, first it consisted of four columns and later on three.

The way I tried solving it first was to use two different gridviews. Okay, so it worked, but the problem was formatting, even though i set a width on the different columns i just didn't get the columns in the two different gridviews to align properly (horizontally speaking) - column 2 and 3 of gridview2 should align to column 3 and 4 in gridview1. And column1 in gridview2 should span across column 1 and 2 in gridview1.

To a certain degree it worked and i was quite happy with the result. But then the next feature request was a linkbutton which wold remove 1 column in both grids, after doing that the column-aligning was messed up.

Okay I thought, now what, I created a class in the GUI-tier with generic names, such as Field1, Field2 .... Field5, and created a List with these where i first created objects of from the first datasource and then from the second datasource. And then I bound the gridview to this list instead.

Wohoo!! everything seemed to work, except that i had to use the rowdatabound event to make column1 span across two columns for the rows concerning the second datasource. (this was achieved using a bool on the class and checking for this bool on each row)

Finally the grid worked but I feel a lttile bit uncomfy with the way it was solved, and i'm writing this asking for advice on whether there is a better way of solving this problem using the Grid from telerik?

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 17 Jul 2008, 08:35 AM
Hi Asti,

Please find the attached project which illustrates the requested functionality. I hope it is helpful.

Greetings,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Asti
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or