Pivot result display in gridview

Posted by Bubaibanerjee under ASP.NET on 8/19/2012 | Points: 10 | Views : 3387 | Status : [Member] | Replies : 1
Hi Sir/Madam,
I have doubt can you please help me..I am very new in s/w Development. below i am describing.
Original Table Structure. Time logged in hours and mins

ID Date TimeLogged UserName
1 10/8/2012 5.50 Bubai
2 11/8/2012 2.30 Bubai
3 10/8/2012 3.30 Bhanu
4 11/8/2012 7.30 Bhanu

I want result like below. User Name should be dynamic. May be lot of users. User name will come from Database table. Please give me broad description as I am very new in the system, for my understanding. I wanr ti show it in Gridview.

Date Bubai Bhanu Total
10/8/2012 5.30 3 8. 30
11/8/2012 2.30 7.30 10
Total 8 10.30 18.30

Please help me to solve this issue. It's really urgent
if you can reply early I'll really appreciate. Thanks in advance.
Thanks and Regards
Bubai Banerjee




Responses

Posted by: Nadh123 on: 8/23/2012 [Member] Starter | Points: 25

Up
0
Down
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"
CellPadding="2" ForeColor="Black" GridLines="None" Width="355px">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
Name
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%#Eval("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
Class
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%#Eval("class") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<table>
<tr>
<td colspan="3">
Marks
</td>
</tr>
<tr>
<td>
Maths
</td>
<td>
Computers
</td>
<td>
Science
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table>
<tr>
<td>
<asp:Label ID="lblname" runat="server" Text='<%#Eval("Maths") %>'></asp:Label>
</td>
<td>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Science") %>'></asp:Label>
</td>
<td>
<asp:Label ID="Label2" runat="server" Text='<%#Eval("class") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="Tan" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:GridView>
I think usefull it
refere this link
http://www.codeproject.com/Articles/46486/Pivoting-DataTable-Simplified

Mahendra
91-9908699686

Bubaibanerjee, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response