Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm little bit confusion about this ,

what is my requirement is i have a nested gridview in that parent grid i have a PK col, and in my child grid footer template i have a dropdown and textbox and Add linkButton.Click on Add button data has to be stored in temprory datatable.And that table i want to bind in my child Grid,

ParentGrid                                                 ChildGrid
Doc_No                                                 Material         Quantity
1                                                      pipes           10
                                                       cubes            2

now what is the issue is after inserting the first row of parent grid details,whenever i insert the 2nd row of parent grid values it's show like this


ParentGrid                                                 ChildGrid
Doc_No                                                 Material         Quantity
1                                                      pipes           10
                                                       cubes            2
2                                                      Pipes           10
                                                       cubes            2
                                                       piping           3

but in 2nd row i'm inserting only piping is 3 but in my temprory DataTable already i have Pipe's and cube's information .So, its displayed all the data in 2nd row.hara i want to try to filtering depending upon the PK col . for that i'm adding in my child grid one more col Doc_no.

Doc_No                                       Material  Quantity  Doc_no
1                                            Pipes      10        1
                                             cubes      2         1
2                                            Pipes      10        1
                                             cubes      2         1
                                             Piping     8         2

now, imagine if this is my temprory datatable , i do filtering the data depending upon the Doc_no col it's easy to displaying .This is my task .

can any one help me to solve this issue...



[edit]Changed question title to meaningful description - OriginalGriff[/edit]
Posted
Updated 1-Oct-12 0:50am
v3
Comments
OriginalGriff 1-Oct-12 6:04am    
Changed question title to meaningful description. Please do not use "Please Solve my Problem" or similar as it does not tell potential answerers what your problem is - that wastes time if they know nothing about gridviews. If you use a more descriptive title, you will get better focussed responses.
[no name] 1-Oct-12 6:07am    
Thank u Griff, if u know about this problem. please solve my issue yar...
Samsani.v.s.Durga Prasad 2-Oct-12 0:05am    
nested grid view will not be visible so how can we insert data

<div>
<asp:GridView runat="server" ID="gridParent" AutoGenerateColumns="false">
<columns>
<asp:TemplateField HeaderText="Parent Label">

<itemtemplate>



<asp:GridView runat="server" ID="gridChild">

<columns>

<asp:TemplateField HeaderText="Child Grid">

<itemtemplate>
<asp:Label runat="server" ID="lblMess" Text="This is child label">



<footertemplate>
<asp:TextBox runat="server" ID="txtDocNo">
<asp:TextBox runat="server" ID="txtQty">
<asp:Button runat="server" ID="btnSubmit" Text="Submit" />











</div>

i think we can find the gridchild (by using row.findcontrol("gridchild) but it will not be visible first time if the gridchild does not contains data
[no name] 2-Oct-12 11:31am    
Please edit your comment by deleting white spaces.

1 solution

XML
<div>
           <asp:GridView runat="server" ID="gridParent" AutoGenerateColumns="false">
               <Columns>
                  <asp:TemplateField HeaderText="Parent Label">

                     <ItemTemplate>
                         <asp:GridView runat="server" ID="gridChild">

                               <Columns>

                                  <asp:TemplateField HeaderText="Child Grid">

                                     <ItemTemplate>
                                        <asp:Label runat="server" ID="lblMess" Text="This is child label"></asp:Label>
                                     </ItemTemplate>
                                      <FooterTemplate>
                                         <asp:TextBox runat="server" ID="txtDocNo"></asp:TextBox>
                                         <asp:TextBox runat="server" ID="txtQty"></asp:TextBox>
                                         <asp:Button runat="server" ID="btnSubmit" Text="Submit" />
                                      </FooterTemplate>

                                  </asp:TemplateField>

                               </Columns>
                         </asp:GridView>
                     </ItemTemplate>

                  </asp:TemplateField>
               </Columns>
           </asp:GridView>
       </div>
 
Share this answer
 
v2

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