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

ItemCommand Firing After Postback

1 Answer 196 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AzureCloud
Top achievements
Rank 1
AzureCloud asked on 13 Feb 2015, 09:10 PM
I have a RadGrid and am using an EditForm for Inserting/Updating. The edit form type is a popup. In the EditForm, I call the ItemCommand code behind function this way:

<telerik:RadButton  CommandName="PerformInsert" ID="rbAddSubscription" runat="server" Text="<%$ Resources: global, string_addSubscription%>" OnClientClicking="btnAddSubscription"></telerik:RadButton>

It works fine. The row gets added to the DB, I rebind the grid, and all is well. But if I then refresh the browser page, the ItemCommand code behind function runs, and inserts the row again. The edit popup is closed. If I debug the ItemCommand during the page refresh, the CommandName is "PerformInsert". I've tried to clear the edit indexes, setting e.canceled = true, etc., but it stays the same. The popup form is not longer open, which is right. The the CommandName were no longer "PerformInsert", my problem would go away, as I'm checking for that in the ItemCommand.

Any insight would be very much appreciated.

 

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 18 Feb 2015, 11:42 AM
Hello,

Try using the client-side  OnClientClicked event instead of OnClientClicking for adding the client logic and see how it goes.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
AzureCloud
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or