UpdateCommand & PostBack

3 posts, 1 answers
  1. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 28 Sep 2011 Link to this post

    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. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 28 Sep 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 28 Sep 2011 Link to this post

    Thanks.
    e.Canceled = true; did the work for me.
Back to Top