Reset Button not working after Submit Button is clicked

Copper Contributor

I added a Reset Button using "Input(reset)" from the tool bar.to my WebForm. It works perfectly as long as I don't click the submit button. Once I click the submit button, it no longer resets form. Any thoughts as to why this behavior occurs

 

Registration.aspx,cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;

namespace DDALLOGS
{
public partial class Registration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
btnSubmit.Click += new EventHandler(this.btnSubmit_Click);
lblSubmit.Text = " ";
lblSubmit.ForeColor = System.Drawing.Color.Red;
lblSubmit.Visible = false;
}

protected void btnSubmit_Click(object sender, EventArgs e)
{
lblSubmit.Text = "Your Registration is Successful";
lblSubmit.ForeColor = System.Drawing.Color.Green;
lblSubmit.Visible = true;
}
}
}


Registration.aspx

... (Code for Fields)

<tr>
<td colspan="3" style="height: 30px"></td>
<td style="height: 29px; width: 150px;"></td>
<td class="text-center" style="height: 29px">
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input id="Reset" type="reset" value="Reset" /></td>
</tr>

... (code to close table)

 

 

 

0 Replies