The ProblemWizard seems to get confused between its navigation controls in its different steps Expected BehaviorThe confirm Message is supposed to appear only when the Next Button of the third step is clicked. Actual Behavior After click Next and Previous a couple of times, Next Button of other steps now display the confirmation message. HTML<asp:Wizard ID="wz1" runat="server" DisplaySideBar="False" ><WizardSteps><asp:TemplatedWizardStep ID="step1" runat="server" Title="Step 1" StepType="start"><ContentTemplate>Step1 Content</ContentTemplate><CustomNavigationTemplate><asp:Button ID="btnNext1" runat="server" UseSubmitBehavior="true" CommandName="MoveNext"
Text="Next1" /></CustomNavigationTemplate></asp:TemplatedWizardStep><asp:TemplatedWizardStep ID="step2" runat="server" Title="Step 2" StepType="Step"><ContentTemplate>Step2 Content</ContentTemplate><CustomNavigationTemplate><asp:Button ID="btnPrevious2" runat="server" CausesValidation="false"
CommandName="MovePrevious" Text="Previous2" /><asp:Button ID="btnNext2" runat="server" UseSubmitBehavior="true" CommandName="MoveNext"
Text="Next2" /></CustomNavigationTemplate></asp:TemplatedWizardStep><asp:TemplatedWizardStep ID="step3" runat="server" Title="Step 3" StepType="Step"><ContentTemplate>Step3 Content</ContentTemplate><CustomNavigationTemplate><asp:Button ID="btnPrevious3" runat="server" CausesValidation="false" UseSubmitBehavior="false"
CommandName="MovePrevious" Text="Previous3" /><asp:Button ID="btnNext3" runat="server" UseSubmitBehavior="true" CommandName="MoveNext"
Text="Next3" /></CustomNavigationTemplate></asp:TemplatedWizardStep><asp:TemplatedWizardStep ID="step4" runat="server" Title="Step 4" StepType="Step"><ContentTemplate>Step4 Content</ContentTemplate><CustomNavigationTemplate><asp:Button ID="btnPrevious4" runat="server" CausesValidation="false" UseSubmitBehavior="false"
CommandName="MovePrevious" Text="Previous4" /><asp:Button ID="btnNext4" runat="server" UseSubmitBehavior="true" CommandName="MoveNext"
Text="Next4" /></CustomNavigationTemplate></asp:TemplatedWizardStep></WizardSteps></asp:Wizard> Code (Behind)using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) ViewState["called"] = false;
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Button btnNext;
btnNext =
step3.CustomNavigationTemplateContainer.FindControl("btnNext3") as Button;
btnNext.Attributes.Add("onclick", "return confirm('" + DateTime.Now.ToString() + "');");
ViewState["called"] = true;
}
}Note that till now I have not found a certain pattern to this problem, each case is different, for example, adding a button would change when the bug would appear. In this example clicking Next acouple of times will show the unexpected behavior.
I don't know what causes this, for now I am gonna let go the use of the Wizard control and create my own solution (showing and hiding panels).Thank you for reading. |