父母/孩子GridView的问题 [英] Problem with Parent / child gridview

查看:91
本文介绍了父母/孩子GridView的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此有点困惑,

我的要求是,我在父网格中有一个嵌套的gridview,我有一个PK col,在我的子网格脚注模板中,我有一个下拉列表和文本框以及Add linkBut​​ton.Click添加按钮数据必须存储在临时数据表中.那张表我想绑定到我的子网格中,

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


但是在第二行中,我仅插入管道为3,但是在我的临时数据表中我已经有了管道和多维数据集的信息.因此,它在第二行中显示了所有数据.取决于PK col.为此,我在子网格中添加了一个col Doc_no.


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


现在,假设这是我的临时数据表,我将根据Doc_no col进行过滤,这很容易显示.这是我的任务.

谁能帮我解决这个问题...



[edit]已将问题标题更改为有意义的描述-OriginalGriff [/edit]


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]

推荐答案

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


这篇关于父母/孩子GridView的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆