Adding a row to the last row column in Gridview ?

Hello,

I have a gridview and it displays data in row column and I want to add a row across in the bottom of the last row for the total value.  How do I do it?  Thanks

Here is my Gridview

<Columns>

<asp:BoundField DataField="Information" HeaderText="Information" SortExpression="Information" HeaderStyle-Width = "600" HeaderStyle-Wrap = "true"/>

</Columns>

 

0
boston_ma
1/20/2009 8:57:24 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
660 Views

Similar Articles

[PageSpeed] 21

use footer? something like maybe.    use TemplateField

 

<Columns>

<asp:BoundField DataField="Information" HeaderText="Information" SortExpression="Information" HeaderStyle-Width = "600" HeaderStyle-Wrap = "true"  FooterText="Total:" />

<asp:TemplateField HeaderText="Total" ItemStyle-Width="80px" >

<ItemTemplate >

<asp:Label runat="server" ID="sdss" Text="your data that you want to add inside here" />

</ItemTemplate>

<FooterTemplate>

<asp:Label runat="server" ID="total" Text="" />

</FooterTemplate>

</asp:TemplateField>

 

 codebehind

 

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

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

{

......

......

}

if (e.Row.RowType == DataControlRowType.Footer)

{

Label lblTotal = (Label)(e.Row.FindControl("total"));

lblTotal.Text =  getTotalFunction();

}

}

</Columns>

 

 

0
Eileithyia
1/20/2009 11:59:06 PM
Reply: