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

UpdateCommand & PostBack

2 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roy Halvorsen
Top achievements
Rank 1
Roy Halvorsen asked on 28 Sep 2011, 09:57 AM
I have a grid with a formtemplate. Inside the formtemplate I have a DropDownList that has set AutopostBack="true" and OnSelectedIndexChanged="something". The DropDownList is inside an updatepanel. In the code behind, in RadGrid1_UpdateCommand, I check if the dropdownlist's SelectedIndex > 0. If not, The UpdateCommand should be terminated (I am using editedItem.Edit = true).

When I play around with the DropDownList several times, set the SelectedIndex to 0, click on the UpdateCommand button, and then again selects for instance index 1 in the DropDownList, a full postback on the page is done, without clicking the UpdateCommand button.
Any ideas?

2 Answers, 1 is accepted

Sort by
0
Accepted
Iana Tsolova
Telerik team
answered on 28 Sep 2011, 11:27 AM
Hi Roy,

To cancel the update command try setting e.Canceled = true; instead of editedItem.Edit = true; and see if it makes any difference.
Additionally, it is not suggested to have ASP:UpdatePanel in RadGrid. You can try either ajaxifying the whole grid or wrap the DropDownList in RadAjaxPanel and see if it works thus.

Best wishes,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Roy Halvorsen
Top achievements
Rank 1
answered on 28 Sep 2011, 11:32 AM
Thanks.
e.Canceled = true; did the work for me.
Tags
Grid
Asked by
Roy Halvorsen
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Roy Halvorsen
Top achievements
Rank 1
Share this question
or