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
160
Validator inside WARP
posted

I'm using a required field validator inside web WARP and when validation fails and a postback occur even though it shouldn't.

When using an Update Panel it does not postback and also with no panel, it also doen't postback.

I've created a sample web page which demonstrates this behaviour. Am I missing something?

 

<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <div>
        <igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server" Height="20px"            Width="80px">
            <table>
                <tr>
                    <td>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1"                            runat="server" EnableClientScript="true" EnableViewState="true" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                       <asp:Button ID="Button1" runat="server" Text="Button" />
                    </td>
                </tr>
            </table>
        </igmisc:WebAsyncRefreshPanel>
    </div>
    </form>
</body>

 

Parents
No Data
Reply
  • 28407
    Verified Answer
    posted

    HI,

     I wired up the Warp's RefreshRequest Client-side  event.

     In this event, I check the Page_IsValid property and if its not true - I cancel the post back.

    Here is my code snippet

    function WebAsyncRefreshPanel1_RefreshRequest(oPanel,oEvent,id){
     //Add code to handle your event here.
     //debugger;
     if (!Page_IsValid)
     {
      oEvent.cancel = true;
     }
    }

     

     

Children