如何将子网格中的一列填充到父网格列Asp.net中 [英] How to fill total of one column in a child grid into parent grid column Asp.net

查看:74
本文介绍了如何将子网格中的一列填充到父网格列Asp.net中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个嵌套网格。我必须在子网格中输入quanity ..总数量必须自动填入特定行的子网格列



父网格 - 项目数量率

--- --- ----

儿童网格 - 数量

2

3

4



因此总数量必须填写相应行的数量。 Quantiy是可编辑的。所以在填充每一行后,必须将其添加到总数量列。





如何解决..



在此先感谢...





Vineetha ..



I have a nested grid. I have to enter quanity in child grid.. the total quantity must be automatically fill in a column of child grid of specific row

parent grid -Item Qty Rate
--- --- ----
Child grid - Qty
2
3
4

so the total qty must be fill in the column Qty of curresponding row. Quantiy is editable. so after filling each row it must be added to total qty column.


How to solve it..

Thanks in Advance...


Vineetha..

推荐答案

int totqty = 0;
protected void gvwInner_RowDataBound(object sender, GridViewRowEventArgs e)
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              Label qty = (Label)e.Row.FindControl("lblQty");
              if (qty != null)
              {
                  qty += Convert.ToInt32(sal.Text);
                  totqty = totqty + qty;
              }
          }
      }
      protected void gvwOuter_RowDataBound(object sender, GridViewRowEventArgs e)
      {

          if (e.Row.RowType == DataControlRowType.DataRow)
          {

              Label lblTotalQty = e.Row.FindControl("lblTotalQty") as Label;
              lblTotalQty.Text = totqty.ToString();
          }

      }


这篇关于如何将子网格中的一列填充到父网格列Asp.net中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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