开发者

ASP.Net Back and Submit

I created a asp.net form. This is that.

<form id="MyForm" runat="server">
    <table>
         <tr>
            <td colspan="2" style="background-color:#EFEFEF">
                 <h3>Card Detail</h3>
            </td>
         </tr>
         <tr>
            <td class="red">Name</td>
            <td>
               <asp:TextBox ID="Name" runat="server" />
               <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"                                                        ControlToValidate="Name" Display="None" SetFocusOnError="true" ErrorMessage="Please enter a valid name." />
            </td>
        </tr>
    </table>
    <div>
        <asp:button id="Myback" runat="server" text="Back" onclientclick="window.history.back();" />
        <asp:button id="MySubmit" runat="server" text="Submit" onclientclick="window.location.href('www.yoursever.com');" />

    </div>
</form>

When the MyBack button is clicked, the validator is active. I want to click of MyBack button, don't do the validator. If I insert CausesValidation="false" within MyBack behaviour, window.history.back() is not working. And MySubmit button is no开发者_StackOverflow社区t working. How can I do this. Please, help me.


make your back button not on server side, there is no need to have it there, use just

<input type="button" onclick="window.history.back();" value="Back"/>


In simple, for the back button you need not to have a dynamic button. Use Static HTML input type and attach javaScript function to it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜