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

closing the edit box on insert

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 03 Jun 2010, 12:50 PM
 HI, I'm trying to validate values on a radgrid when I do an insertion.

The validation all works fine on the ItemCommand Event below, however if the value I want to insert already exists I wish to cancel the insertion and close the edit box. The insertion is cancelled however the edit/insert box remains open.
I use the
RadGrid1.MasterTableView.ClearEditItems();
                RadGrid1.Rebind();
to clear the edititems however the editmode stays open e.KeepInEdit mode is not available at this stage, how do I close the edit boxes

Thanks
Robert


if (baseline.BaselineExists(id, Convert.ToInt32(dayDateId), start, end, baselineType))
            {
                if (e.CommandName == RadGrid.PerformInsertCommandName)
                {
                    gridMessage = "this baseline cannot be inserted. Reason: a baseline already exists for this day and time";

                }
                else
                {
                    gridMessage = "baseline " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["id"] + " cannot be updated. Reason: a baseline already exists for these times";
                }
                e.Canceled = true;
                RadGrid1.MasterTableView.ClearEditItems();

                RadGrid1.Rebind();
                return;

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jun 2010, 02:11 PM
Hello Robert,

In order to close the insert form you have to add the following code.

CS:
      RadGrid1.MasterTableView.IsItemInserted = false;
      RadGrid1.Rebind();



Hope this information helps you.

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