Click here to Skip to main content
14,668,490 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

You can use ItemTemplate field to insert the a grid inside a grid
   
Rate this:
Please Sign up or sign in to vote.

Solution 3

see example below...

<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..
   
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.
Rate this:
Please Sign up or sign in to vote.

Solution 4

Please Go This Page And Find Grid View Demo You Can Get Perfect Code Form This page.


http://crazzynewsindia.blogspot.in/p/collection.html[^]
   
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...
Rate this:
Please Sign up or sign in to vote.

Solution 5

   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100