Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
813
Problem while having a button with SubmitBehavior = true in the WARP
posted

I have two buttons within a WARP. one with submitbehavior = true and other with false.

further I have javascript on the button with Submit Behavior true which will decide wheather to go server side or not.

When I return false from the javascript it is not clearing the entry button had made in "Page.Request.Form" so when i press anopther button and when it goes to server side it fires the event for a button i pressed previously.

It is not happening when I remove the WARP from page.

I have made a sample project to confirm this and its behaving same.

Please let me know If there is any solution for this.

  • 24497
    posted

    Hi,

    It is possible that once an action of a child control in WARP occurred, all following async postbacks may raise same server event. That happens if control sets value in its private <input> (or another field) request to raise particular event and that "request" value is never removed. For example, similar happens with DropDownList which has enabled multiselection.

    Unfortunately WARP is not able to fix that. Application may get around similar problem by validation for actual trigger and if trigger is wrong, then skip handler. Example:

    protected void MyControlWithWrongEvent_SelectedIndexChanged(object sender, EventArgs e)
    {
     
    string id = this.Request.Form["__EVENTTARGET"];
     
    if(id != null && id.IndexOf("MyControlWithWrongEvent") < 0)
       
    return;
      ...
    }