code:
<asp:GridView ID="grdClients" runat="server" AutoGenerateColumns="false" CssClass="mGrid"
AlternatingRowStyle-CssClass=" alt" OnRowDataBound="grdClients_ RowDataBound" ShowFooter="True">
<AlternatingRowStyle CssClass="alt"></ AlternatingRowStyle>
<Columns>
<asp:BoundField DataField="Name" HeaderText="Clients" />
<asp:BoundField DataField="Family" HeaderText="Code" Visible="false" />
<asp:BoundField DataField="Long_Name" HeaderText="Client Name" Visible="false" />
<asp:BoundField DataField="Brokerage" ItemStyle-HorizontalAlign=" Right" HeaderText="Rev"
DataFormatString="{0:N}">
<ItemStyle HorizontalAlign="Right"></ ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="SharePercent" HeaderText="Share in Revenue %" ItemStyle-Width="20px"
ItemStyle-HorizontalAlign=" Right" DataFormatString="{0:N}">
<ItemStyle HorizontalAlign="Right" Width="20px"></ItemStyle>
</asp:BoundField>
</Columns>
<FooterStyle Font-Bold="True" />
<HeaderStyle Font-Size="11px" />
</asp:GridView>
protected void grdClients_RowDataBound(object sender, System.Web.UI.WebControls. GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
decimal TotalExps = (decimal)DataBinder.Eval(e. Row.DataItem, "Brokerage");
_TotalExpTotal += TotalExps;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
//Label lblSummary = (Label)e.Row.FindControl(" lblSummary");
//lblSummary.Text = String.Format("{0:D}", _TotalExpTotal);
e.Row.Cells[0].Text = "Total";
e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
e.Row.Cells[3].Text = String.Format("{0:N}", _TotalExpTotal);
}
}
Comments
Post a Comment