Decided to make a new thread per http://www.telerik.com/community/forums/aspnet-ajax/grid/grid-footer-validation.aspx
Using the ItemDataBound, everything is working except the e.Canceled = true; line. When the values don't match I get the response.write "Cancelled" message on my page as intended but the e.Canceled = true; line doesnt execute and the updates execute . And when they do match, update executes sucessfully and I dont get the message as intended.
Using the ItemDataBound, everything is working except the e.Canceled = true; line. When the values don't match I get the response.write "Cancelled" message on my page as intended but the e.Canceled = true; line doesnt execute and the updates execute . And when they do match, update executes sucessfully and I dont get the message as intended.
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridFooterItem)
{
GridFooterItem fitem = (e.Item as GridFooterItem);
string value1 = fitem["CALENDAR_DAYS_MTD"].Text;
string value2 = fitem["WEEKENDS_MTD"].Text;
string value3 = fitem["HOLIDAYS_MTD"].Text;
string value4 = fitem["BUSINESS_DAYS_MTD"].Text;
int footervalue1;
int footervalue2;
int footervalue3;
int footervalue4;
int.TryParse(value1, out footervalue1);
int.TryParse(value2, out footervalue2);
int.TryParse(value3, out footervalue3);
int.TryParse(value4, out footervalue4);
//to get the value only.
if (footervalue2 + footervalue3 + footervalue4 != footervalue1)
{
e.Canceled = true; // Cancel Update
Response.Write("Cancelled");
}
}
}