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

Persist Updating Row's controls state

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rafael Enriquez
Top achievements
Rank 1
Rafael Enriquez asked on 09 Jul 2010, 09:59 PM
Hi:

I have a radgrid (working with radajaxmanager). I'm using CommandItemTemplate to issue grid commands (insert/update). I'm using FormTemplate to insert/edit records. inside FormTemplate, I have normal asp textboxes, dropdowns and validators. Validators have servervalidate handler. When user clicks Update, command is fired OK and validations happen OK. The problem is that, after callback ends, the updating row gets closed, no matter if there were invalid validators. In the same app I have another grid working ok: updating row stay expanded if validation was wrong and every invalid validator displays. The only difference I can see in the way the 2 grids are performing is that, the right grid does not issue the NeedDataSource event, while the wrong grid does. Does anybody have a clue on what's happening??? how can I persist the state of the updating item??? Notice that I need not onlt the Expanded state, but each of the validator state too.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 14 Jul 2010, 09:45 AM
Hello Rafael,

If you are implementing custom updates / inserts, probably the grid gets updated and rebound even though the page is invalid. Try canceling the update / insert event manually if the page is invalid:

protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
    if ((e.CommandName == RadGrid.UpdateCommandName ||
        e.CommandName == RadGrid.PerformInsertCommandName) && !Page.IsValid)
    {
        e.Canceled = true;
        return;
    }
}

The above event will prevent the update / insert operation if the validation controls have invalidated the page. The Edit form will stay open without the update / insert action taking place.

Regards,
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
Tags
Grid
Asked by
Rafael Enriquez
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or