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

Validation before Insert in Radgrid

1 Answer 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Said
Top achievements
Rank 1
Said asked on 05 May 2014, 02:44 PM
Hi,
i want to validate my radgrid on server side when the user click the "Add new record" btn,
if existing data are valid continue and show the editform else show error message and cancel insert operation,
so, my question is : what is the event i should use.
thanks.

1 Answer, 1 is accepted

Sort by
0
Said
Top achievements
Rank 1
answered on 05 May 2014, 03:30 PM
so i found a solution :
the event was OnItemCommand and the command Name = RadGrid.InitInsertCommandName
the code is :
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                if (e.Item.OwnerTableView.Name == "ParentGrid")
                {
                    if(!this.isValid())//My Custom Validation
                        e.Canceled = true;
                }
            }
        }

thanks
Tags
Grid
Asked by
Said
Top achievements
Rank 1
Answers by
Said
Top achievements
Rank 1
Share this question
or