i have two pages one in index.html and one in EnquireTest.aspx
Code
Enquire nowafter clicking above popup will get open, popup code
Code
Fill out the form below to get the specific knowledge needed to become skilled in any discipline
×and below is my aspx code
C#
--%>
--%>
--%>
--%>
--%>
--%>
Select Locations
--%>
Select Courseand this is my is my EnquireTest.aspx.cs
C#
protected void btnSubmit_Click(object sender, EventArgs e)
{
Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim());
if (Captcha1.UserValidated)
{
DataSet dss = new DataSet();
a.Mode = "InsertEnquiry";
a.StudentName = txtName.Text.Trim();
a.EmailID = txtEmailID.Text.Trim();
a.MobileNumber = txtMobileNo.Text.Trim();
a.Location = ddlLocations.SelectedItem.Text.ToString();
a.Course = ddlCourse.SelectedItem.Text.Trim();
dss = objDal.getEnquiry(a);
if (dss.Tables[0].Rows.Count > 0)
{
// Display success message
txtName.Text=string.Empty;
txtEmailID.Text = string.Empty;
txtMobileNo.Text = string.Empty;
ddlLocations.SelectedIndex = 0;
ddlCourse.SelectedIndex = 0;
txtCaptcha.Text = string.Empty;
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Information saved succesfully')", true);
}
else
{
// Display error message
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Error in inserting Application')", true);
}
}
else
{
// Display captcha error message
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Enter Correct Captcha Code')", true);
}
}after clicking on submit textbox value is not getting to empty. it is still showing entered value. and also the after clciking on submit debugger is not getting called.
Please give me solution.

Abhishek YadavRank #217 · 11.3K reputationPosted Mar 28, 2024, 2:17 AM EDT
To clear the textboxes after submitting the form and ensure that the debugger is being hit, you can make the following changes in your code:
After saving the data successfully, you can clear the textboxes by setting their value to empty string. Here's an updated version of your code to clear the textboxes:
// Display success message txtName.Text = string.Empty; txtEmailID.Text = string.Empty; txtMobileNo.Text = string.Empty; ddlLocations.SelectedIndex = 0; ddlCourse.SelectedIndex = 0; txtCaptcha.Text = string.Empty; // Display success message ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Information saved successfully')", true);Make sure that you have set up your project for debugging by setting breakpoints in your code-behind file. Also, ensure that you are running your application in Debug mode. Run your application in Visual Studio and make sure that you are attaching the debugger to the correct process (usually "w3wp.exe" or your development server). This will allow you to debug your server-side code.
After making these changes, you should be able to clear the textboxes after submitting the form and hit the debugger for further troubleshooting.