K
Kevin Blount
I'm trying to create a mutli-form page on my website, but having trouble
with the PostBack stuff. And yes, I'm new to C# - my background of 8yrs
is original ASP, and I'm getting easily confused now... which is most
aggravating
My sample test code is below...
The idea is that the page can have 2 or even 3 panels to show different
form elements, and then I hide all the panels and process the
information gather from the forms.
The bit that's failing right now is finding out of the form elements
shown in panel2 have been submitted, then hiding both panels to begin
processing the form fields. I did try:
if (panel2.Visible == true)...
but that failed as for each postback it was true; I also tried searching
for a way to check which button was pressed, but that failed for me too..
basically I'm stuck.. I'm trying this PostBack things as 5 days of
trying to get another method to work has finally got the better of me,
and I'm looking for a new way to have multiple forms presented and
submitted to a single processing page (kinda like a wizard.. but I' not
using the Wizard Control)
any suggestions??
with the PostBack stuff. And yes, I'm new to C# - my background of 8yrs
is original ASP, and I'm getting easily confused now... which is most
aggravating
My sample test code is below...
The idea is that the page can have 2 or even 3 panels to show different
form elements, and then I hide all the panels and process the
information gather from the forms.
The bit that's failing right now is finding out of the form elements
shown in panel2 have been submitted, then hiding both panels to begin
processing the form fields. I did try:
if (panel2.Visible == true)...
but that failed as for each postback it was true; I also tried searching
for a way to check which button was pressed, but that failed for me too..
basically I'm stuck.. I'm trying this PostBack things as 5 days of
trying to get another method to work has finally got the better of me,
and I'm looking for a new way to have multiple forms presented and
submitted to a single processing page (kinda like a wizard.. but I' not
using the Wizard Control)
any suggestions??
Code:
<form action="" method="post" name="pageform" id="pageform" runat="server">
<%
if (IsPostBack)
{
//what 'if' goes here to show panel2 if panel1 forms are submitted
{
panel2.Visible = true;
panel1.Visible = false;
}
//what 'if' or 'else' goes here to hide both panels if panel2 form
fields are submitted??
{
panel2.Visible = false;
panel1.Visible = false;
//call method(?) to process form fields
}
}
else
{
panel2.Visible = false;
panel1.Visible = true;
}
%>
<asp:HiddenField ID="stepField" value=""></asp:hiddenfield>
<asp:Panel ID="panel1" runat="server">
<asp:TextBox Columns="20" ID="text1" runat="server"
TextMode="SingleLine">1</asp:TextBox>
<asp:Button ID="panel1_btn" runat="server" Text="Continue"></asp:Button>
</asp:Panel>
<asp:Panel ID="panel2" runat="server">
<asp:TextBox Columns="20" ID="text2" runat="server"
TextMode="SingleLine">2</asp:TextBox>
<asp:Button ID="panel2_btn" runat="server" Text="Finish"></asp:Button>
</asp:Panel>
</form>