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

[Solved] Pivot, crosstab, transpose datagrid

1 Answer 278 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Acid
Top achievements
Rank 1
Acid asked on 23 Oct 2009, 11:55 PM

Dear Telerik,

I already found some posts regarding pivotting a table, but I'm not sure what to do.

I've got two tables. One with a list of dates from 01-01-2000 untill 31-12-2025 and one table with appointent information (ScheduleDate, StartTime, EndTime, EmployeeID, ShiftID). Both tables are stored in SQL server 2005.

I would like to show those appointments in a datagrid. This datagrid is (for this moment) readonly.

I've already made a stored procedure with 2 variables (@Startdate and @EndDate). Those dates are set in the silverlight client and a WCF service returnes the values.

What is the best way to do this?

1.) Stored procedure on sql server (which costs a lot of time on SQL) and display it in your datagrid.

2.) Do it on the client? If yes, how to do this? How to group the information in dynamic columns because the column changes (Dateheader).

3.) linq?

4.) Other options?

PS.: In the database it's possible that an employee has multiple appointments one 1 day. All those appointments should be displayed in 1 cell.

In the future I probarly would like to drag and drop appointments from a listview to the datagrid.

The result should be simular as your Timeline View in the Scheduler Control. This control I'm already using for displaying an employees schedule. I would like to use the datagrid for this purpose because it's a contracting module. Everything is already finished with your datagrid, but I would like to show the schedule in this module as a hierarchical datarow.

Please consider that I am a SQL guy and not a experienced C# programmer so any explanation would be helpfull.

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 26 Oct 2009, 12:53 PM
Hello Acid,

From the description you have provided it seems that you need to transpose your data. My colleague Stefan Dobrev has created a blog post which explains how to do this.

The other option would be a stored procedure on the server. It is up to you to decide.

Greetings,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Acid
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or