Click here to Skip to main content
15,896,490 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi,

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..
Posted
Comments
Prakriti Goyal 23-Jul-14 5:00am    
Kindly mention your code.

1 solution

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();
          }

      }
 
Share this answer
 
Comments
Vineetha Ravindranath 24-Jul-14 3:48am    
Thank You..

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