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

Grid - Prevent automatic SqlCommands

1 Answer 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 19 Jan 2011, 11:57 AM
Hi,

I have a rad grid bind to a datasource with all the SQL operations(select,insert,update,delete). Everything works fine. Now I had add on the Grid Insert_Command event (for new record insertion) a check where it compares the new insert value with the existing values of the grid. If the new value entered already exists, I exit the function and display a message on the screen. My problem is that the grid continues and execute the insert command which is declare on the datasource. How can I prevent the automatic insert operation to be executed on demand

Thanks

1 Answer, 1 is accepted

Sort by
0
George
Top achievements
Rank 1
answered on 19 Jan 2011, 03:46 PM
Ok, I think I have manage to solve my problem using the following code

Protected Sub RadGrid1_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand
        ...
            If ( x.Trim.Equals(y) ) Then
                e.Canceled = True
                Exit Sub
End Sub
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
George
Top achievements
Rank 1
Share this question
or