I followed the HowTo on setting footer values in the code behind, but I'm getting a GridException because the footer value I'm looking for doesn't exist in the Detail Table, but the ItemDataBound is fired for all tables.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
sum+=double.Parse((dataItem[ "Template1"].FindControl("TextBox1") as TextBox).Text);
}
else if (e.Item is GridFooterItem)
{
GridFooterItem footer = (GridFooterItem)e.Item;
(footer[ "Template1"].FindControl("TextBox2") as TextBox).Text = sum.ToString();
clientID = (footer["Template1"].FindControl("TextBox2") as TextBox).ClientID;
}
}
The bold line above throws the exception because the ItemDataBound was triggered by the Detail table which doesn't have a "Template1" column. How can I check for the existence of the "Template1" column thereby preventing the exception?
Thanks
Greg
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
sum+=double.Parse((dataItem[ "Template1"].FindControl("TextBox1") as TextBox).Text);
}
else if (e.Item is GridFooterItem)
{
GridFooterItem footer = (GridFooterItem)e.Item;
(footer[ "Template1"].FindControl("TextBox2") as TextBox).Text = sum.ToString();
clientID = (footer["Template1"].FindControl("TextBox2") as TextBox).ClientID;
}
}
The bold line above throws the exception because the ItemDataBound was triggered by the Detail table which doesn't have a "Template1" column. How can I check for the existence of the "Template1" column thereby preventing the exception?
Thanks
Greg