i have two pages one in index.html and one in EnquireTest.aspx
after clicking above popup will get open, popup code
and below is my aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnquireTest.aspx.cs" Inherits="ApplicationForm.LandingPage.EnquireTest" %>
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
and this is my is my EnquireTest.aspx.cs
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 YadavPosted Mar 28, 2024, 6:17 AM
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:
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.