Guest User

Untitled

a guest
Jul 16th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. protected void dgCustomer_DataBound(object sender, System.EventArgs e)
  2. {
  3. Label pLabel = new Label();
  4. double dItemPremium = (Eval("Premium")!= DBNull.Value) ? (double)(Eval("Premium")) : 0;
  5. pLabel.Text = dItemPremium.ToString("0.00");
  6. dTotal_m += dItemPremium;
  7.  
  8. dgCustomer.HeaderRow.TableSection = TableRowSection.TableHeader;
  9. dgCustomer.FooterRow.TableSection = TableRowSection.TableFooter;
  10. dgCustomer.FooterRow.Controls.Add(pLabel);
  11.  
  12. }
  13.  
  14.  
  15. protected void dgCustomer_RowCreated(object sender, GridViewRowEventArgs e)
  16. {
  17. if (e.Row.RowType == DataControlRowType.DataRow)
  18. {
  19.  
  20. dTotal_m += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem,"Premium"));
  21.  
  22. }
  23. else if (e.Row.RowType == DataControlRowType.Footer)
  24. {
  25. e.Row.Cells[0].Text = "Totals:";
  26. e.Row.Cells[1].Text = dTotal_m.ToString("0.00");
  27.  
  28. e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Right;
  29. e.Row.Font.Bold = true;
  30. }
  31. }
  32.  
  33. <asp:TemplateField>
  34. <ItemTemplate>
  35. <%#DataBinder.Eval(DataItem,"Premium")%></ItemTemplate>
  36. <HeaderTemplate>
  37. Premium Amount Paid</HeaderTemplate>
  38. </asp:TemplateField>
  39.  
  40. e.Row.Cells[0].Text
  41.  
  42. string tempstr=((Label)dgCustomer.Rows[e.RowIndex].Cells[<cell_number>].FindControl("Label_ID")).Text;
  43.  
  44. <ItemTemplate>
  45. <%= DataBinder.Eval(DataItem,"Premium")%></ItemTemplate>
  46. <HeaderTemplate>
Add Comment
Please, Sign In to add comment