Question

I want to validate the users changes on a page before allowing them to go to another page. If the validation fails I want to stop the pager from changing the page.

For example:

protected void rgOrderItem_PageIndexChanged(object source, GridPageChangedEventArgs e)
{
    if (Mapvalues(false))
    {
        rgOrderItem.CurrentPageIndex = LastPageIndex;
        rgOrderItem.DataBind();
    }
}

This does not work. The pager changes regardless. Anyone know how to stop a page change event? Thanks, Tony

Was it helpful?

Solution

Please try with the below code snippet.

protected void RadGrid1_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
{
    if (Mapvalues(false))
    {
        e.Canceled = true; //Prevent to execute pagging functionality
    }
}
protected void RadGrid1_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
    if (Mapvalues(false))
    {
        e.Canceled = true; //Prevent to execute pagging functionality
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top