views:

1309

answers:

2

My data is such that I want to display values for the Employee and the Supervisor for a particular record. Instead of describing it, I'll show you a rough example:

Employee Supervisor Name    Last Activity    Count    Name    Last Activity    Count   


How can I create this for a GridView? I essentially want 2 rows for the headings, and some of the cells should span more than one column.

A: 

do you need the editing or sorting features of the gridview? I've found trying to do anything aside from display straight tabular data in the gridview is an exercise in patience.

For simplicity's sake I'd recommend using a repeater and writing your own table HTML if your grid is readonly.

Kyle West
That may be the route we take, but for the purpose of mutual education I wonder if you could do such a thing with the GridView.
Larsenal
A: 

That may be the route we take, but for the purpose of mutual education I wonder if you could do such a thing with the GridView. – DLarsen

you can, but it is by no means easy. If you haven't already and you can afford to switch you may want to look at ASP.NET MVC, it gives you complete control of the HTML. You may want to check out this link about data-access in general. http://www.asp.net/learn/data-access/ #15, #27, #51-53 may get you some ideas pertinent to your gridview issue.

Kyle West
At my day job, the chances of going ASP.NET MVC are slim to none. Personally, I'm a huge fan of 100% control over markup. Once you achieve expert-level proficiency in creating the markup, the utility of ASP.NET controls doing it for you nearly disappears.
Larsenal