Click here to Skip to main content
15,882,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to create a gridview inside a gridview
Posted
Comments
[no name] 6-Sep-10 1:03am    
You've got to provide a bit than this is you want help.
thatraja 6-Sep-10 2:30am    
You should give full details man, for your simple question my answer -> Put a Gridview inside the template column of Gridview......that's all

It sounds like you need something like this: Editable Nested GridView (All-in-One)[^]

Probably, this has more features than you need. You don't need to make it editable for you. Customize it, take hints and have a look how a hierarchical kinda grid can be achieved.
 
Share this answer
 
v2
You can use ItemTemplate field to insert the a grid inside a grid
 
Share this answer
 
see example below...

XML
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" DataSourceID="SqlDataSource2"GridLines="None"ShowFooter="false" ShowHeader="false">
<PagerSettings Mode="NextPrevious" NextPageText="Next" PreviousPageText="Previous" />
 <Columns>
    <asp:TemplateField>
      <ItemTemplate>

/* Outer grid body*/

               <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" GridLines="None" ShowHeader="False">
                                                                                              <Columns>
                                                                                                 <asp:TemplateField>
                                                                                                 <ItemTemplate>
           
             inner grid  body
             
            
                                                                                                 
                                                                                               
                                                                                               

     /* inner grid ends */


Implement whatever contents you want inside body of gridview(s)....

Thank you..
 
Share this answer
 
Comments
fjdiewornncalwe 11-Feb-13 17:15pm    
Please check how old a question is before providing a new answer. This one is over two years old, has valid answers, and really doesn't need another one. Chances that the OP even cares any more is pretty slim as well. Cheers.
vinodkumarnie 11-Feb-13 23:02pm    
Thanks.
Please Go This Page And Find Grid View Demo You Can Get Perfect Code Form This page.


http://crazzynewsindia.blogspot.in/p/collection.html[^]
 
Share this answer
 
Comments
Naz_Firdouse 23-Apr-13 7:51am    
it's better to post the corresponding link as well ( gridView Demo one)...
so that it would be helpful to others...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900