
Question:
So in the process of combining my default.aspx form page with the confirm.aspx confirmation page, I had to create panels and show/hide them at the initial loading of the page.
The form is a comment/complaint form, so users will submit their info, and an e-mail is generated and sent to a web master.
I have 4 panels: Panels 1 + 3 show by default and are set to visible early in the script like so:
protected void Page_Load(object sender, EventArgs e)
{
Panel1.Visible = true;
Panel2.Visible = false;
Panel3.Visible = true;
Panel4.Visible = false;
}
Basically, I want panels 1+3 to become hidden, and 2 + 4 to become visible once the user submits the form and no errors are found within the forum.
Would I run the script to change the visibility at the try
function when an email is sent, or right before the frmReset
function?
Also, is there a specific function I need that will switch the panels visibility AFTER submitting the form with no errors found? (Other than changing visibility to true
or false
)
According your comments, you will resolve your requirement in two steps.
1st, update your page load to avoid reverting visibility after you change it :
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack){
Panel1.Visible = true;
Panel2.Visible = false;
Panel3.Visible = true;
Panel4.Visible = false;
}
}
2nd, you have to change the visibility on the try
method :
protected void Try_Click(object sender, EventArgs e)
{
Panel1.Visible = false;
Panel2.Visible = true;
Panel3.Visible = false;
Panel4.Visible = true;
}