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

InsertCommand - staying in Insert mode if all requried fields are not completed

3 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 20 Feb 2009, 09:28 PM
Hi,

I am attempting to present a RadAlert if certain required fields are not completed in a RadGrid Insert. The alert message comes up fine, but the grid closes and we are no longer in Insert Mode.

I have tried this

   editedItem.Edit = True
            RadGrid1.Rebind()
Exit Sub

without success. Does anyone know how to cancel an insert from within the InsertCommand Event? Thanks.



3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Feb 2009, 07:18 AM
Hi Karl,

Try with the following code snippet in the InsertCommand event.

CS:
        //to show the Insert form 
        e.Item.OwnerTableView.IsItemInserted = true
         
        //to close the insert form 
        e.Item.OwnerTableView.IsItemInserted = false
        
         

Shinu
0
Karl Wilkens
Top achievements
Rank 1
answered on 23 Feb 2009, 01:17 PM
I just tried this and it did not work. I am executing the command and then exiting the sub.

e.Item.OwnerTableView.IsItemInserted = True
Exit Sub

The grid still closes and goes out of insert mode. Any thoughts?


0
Yavor
Telerik team
answered on 24 Feb 2009, 08:36 AM
Hello Karl,

You can rebind the grid control, to ensure that the setting is applied.
Additionally, you can simply use the Insert/ItemCommand, to cancel the event (e.Canceled=true), whenever a conditions is not met.
I hope these suggestions help.

Greetings,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Karl Wilkens
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or