This is a migrated thread and some comments may be shown as answers.

Radgrid e.Canceled = true; Not working

1 Answer 172 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elton
Top achievements
Rank 1
Elton asked on 17 Sep 2012, 07:03 PM
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. 


  
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");
 
        }
         
    }
}





1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Sep 2012, 05:53 AM
Hi,

The ItemCreated and ItemDataBound events cannot be cancelled. See this help documentation.

Thanks,
Shinu.
Tags
Grid
Asked by
Elton
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or