
Jeff Reinhardt
Top achievements
Rank 1
Jeff Reinhardt
asked on 17 Aug 2010, 05:02 PM
I have a grid that I want to set the footer text to a datafield in datasource the grid is bound to. How can I do this?
6 Answers, 1 is accepted
0

Cori
Top achievements
Rank 2
answered on 17 Aug 2010, 06:11 PM
What are you trying to set the FooterText to? A single field or an aggregate of the column?
0

Jeff Reinhardt
Top achievements
Rank 1
answered on 17 Aug 2010, 06:27 PM
Just one of the fields in the data source, no calculations, or aggregate of any kind.
0

Princy
Top achievements
Rank 2
answered on 18 Aug 2010, 12:24 PM
Hello Jeff,
I am not quite sure about your requirement. If you want to set footer text for a column try the following code snippet.
C#:
Thanks,
Princy.
I am not quite sure about your requirement. If you want to set footer text for a column try the following code snippet.
C#:
protected
void
RadGrid1_ItemDataBound1(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridFooterItem)
{
GridFooterItem footerItem = (GridFooterItem)e.Item;
footerItem[
"ColumnUniqueName"
].Text =
"Footer Text"
;
//setting footer text for column
}
}
Thanks,
Princy.
0

Jeff Reinhardt
Top achievements
Rank 1
answered on 18 Aug 2010, 01:45 PM
I know how to simply set the footer text, I can do that as part of the control tag in the HTML markup. I want to know how to set it so that it has the DATAFIELD value.
IE.
FooterText = "Cart Total: " + DataSet.Tables[0].Rows[0]["CartTotal"].ToString();
Or
IE.
FooterText = "Cart Total: " + DataSet.Tables[0].Rows[0]["CartTotal"].ToString();
Or
<
telerik:GridBoundColumn DataField="CartTotal" FooterText="Cart Total: <%#Bind("CartTotal")%>" />
Or something like that so I can get a datafield in the footer text. I do not want any calculations done, this is being done in SQL, I want to just display the field in the footer text.
0

Jeff Reinhardt
Top achievements
Rank 1
answered on 18 Aug 2010, 07:28 PM
There has to be a way to do this??? Anyone?
0
Hi Jeff,
As Princy showed, you need to use RadGrid's ItemDataBound event to get the footer cell and set its text. You cannot bind a footer cell text to a data field, because the footer is not databound to a grid record.
Veli
the Telerik team
As Princy showed, you need to use RadGrid's ItemDataBound event to get the footer cell and set its text. You cannot bind a footer cell text to a data field, because the footer is not databound to a grid record.
Veli
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items