Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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 30-Sep-12 23:57pm
Edited 1-Oct-12 0:50am
v3
Comments
OriginalGriff at 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.
Durgapasad at 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">

<asp:TemplateField HeaderText="Parent Label">


 

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



<asp:TemplateField HeaderText="Child Grid">


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

 


<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

1 solution

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

Solution 1

<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>
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 395
1 Prakriti Goyal 254
2 Yogesh Kumar Tyagi 224
3 Sergey Alexandrovich Kryukov 183
4 CPallini 160
0 OriginalGriff 6,652
1 Sergey Alexandrovich Kryukov 5,449
2 Maciej Los 3,474
3 Peter Leow 3,303
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 3 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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