I have a pege with a web tool bar and ultrawebgrid.
i am using click for toolbar and BeforeRowinsert for webgrid clientside events.
I perform some validations in the before row insert event.
when i enter wrong data and click a button on the toolbar ..the before row insert event performs the validation.
I want to stop the postback if a validation fails in the before row insert event (The tool bar click event).
Can u pls tell me how can i do it.
Hello,
You can cancel client side event BeforeRowInsertHandler with return true.Please take a look at the code below: <script type="text/javascript"> function Insert(a, b, c) { if (validation == false) { // cancel adding return true; } else { // allow adding return false; } } </script>
Hope this helps.
I have used the same code. But i dont just want to cancel the BeforeRowInsert event .
the postback is caused due to the click of the ultraweb toolbar button.
Generally we have event.needPostBack = false ; to cancel the postback of a toolbar button in toolbar click clientside event.
When i click a save button of toolbar first the toolbarevent executes and then the BeforeRowInsert event fires up.
In the beforeRowInsert event i can get the object of the toolbar but i dont find a way to cancel the postback in this event.
could u suggest me a way to do this.
Thanks for the reply.