Clear all fields in ASP.net form

前端 未结 7 903
忘掉有多难
忘掉有多难 2020-12-13 20:20

Is there an easy way to reset all the fields in a form?

I have around 100 controls in my asp.net form and there are submit and reset buttons.

How do I make a

相关标签:
7条回答
  • 2020-12-13 21:06

    You can make use of OnClientClick event. This will reset all all the control present on the form. OnClientClick="this.form.reset();return false;"

    See the Code :

    <asp:Button ID="Reset_Button" runat="server" Text="Reset" 
        Width="81px" OnClientClick="this.form.reset();return false;" />
    
    0 讨论(0)
提交回复
热议问题