How to Bind DataList inside GridView in ASP.NET C#??

Posted by prakashmondal5-21103 under ASP.NET on 4/2/2014 | Points: 10 | Views : 2854 | Status : [Member] | Replies : 1
I want to bind DataList inside GridView.....
I try to bind DataList inside GridView. but only bind DataList Individually..

DataBaseTable:
DeptID Dept Days Time Team
D-1 ABCD Monday 10:00-12:00 A Team
D-1 XYZ Monday 10:00-12:00 B Team
D-1 ABCD Monday 12:00-02:00 A Team
D-1 ABCD Tuesday 10:00-12:00 A Team

SourseView(Display.aspx):

<form id="form1" runat="server">
<div>

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
onprerender="GridView1_PreRender">
<Columns>
<asp:BoundField DataField="Days" HeaderText="Days" />
<asp:TemplateField HeaderText="10:00-12:00">
<ItemTemplate>
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table class="style1">
<tr>
<td>
<asp:LinkButton ID="LinkButton1" runat="server"><%#Eval("Dept10") %></asp:LinkButton>
</td>
<td>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Team10") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="12:00-02:00">
<ItemTemplate>
<asp:DataList ID="DataList2" runat="server">
<ItemTemplate>
<table class="style1">
<tr>
<td>
<asp:LinkButton ID="LinkButton2" runat="server"><%#Eval("Dept12") %></asp:LinkButton>
</td>
<td>
<asp:Label ID="Label2" runat="server" Text='<%#Eval("Team12") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
</ItemTemplate>
</asp:DataList>

</div>
</form>
I want to Bind DataList1 and DataList2 inside this GridView.........

I want to Output this Style:

Days 10:00-12:00 12:00-02:00
Monday ABCD A Team
XYZ B Team

Tuesday ABCD A Team

Please Help me.




Responses

Posted by: Nagarjuns on: 4/3/2014 [Member] Starter | Points: 25

Up
0
Down
Hi,

Please check once the below url
http://www.codeproject.com/Questions/273544/how-to-bind-data-in-datalist-with-in-gridview



prakashmondal5-21103, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response