+2010-07-21 Marek Habersack <mhabersack@novell.com>
+
+ * Wizard.cs: made rendering 100% compliant with .NET (button IDs,
+ 2.0+)
+ Implemented LayoutTemplate (4.0+)
+
+ * LinkButton.cs: render id first
+
+ * CreateUserWizard.cs: CreateUserNavigationContainer.UpdateState
+ doesn't add a previous button if we're on the first step.
+
2010-07-20 Marek Habersack <mhabersack@novell.com>
* StyleCollection.cs: added
if (CompleteStep == null)
WizardSteps.AddAt (WizardSteps.Count, new CompleteWizardStep ());
-
+
base.CreateChildControls ();
}
protected override void UpdateState ()
{
// previous
- if (_createUserWizard.AllowNavigationToStep (_createUserWizard.ActiveStepIndex - 1)) {
+ int previous = _createUserWizard.ActiveStepIndex - 1;
+ if (previous >= 0 && _createUserWizard.AllowNavigationToStep (previous))
UpdateNavButtonState (Wizard.StepPreviousButtonID + Wizard.StepPreviousButtonType, Wizard.StepPreviousButtonText, Wizard.StepPreviousButtonImageUrl, Wizard.StepPreviousButtonStyle);
- }
- else {
+ else
((Table) Controls [0]).Rows [0].Cells [0].Visible = false;
- }
// create user
UpdateNavButtonState (Wizard.StepNextButtonID + _createUserWizard.CreateUserButtonType, _createUserWizard.CreateUserButtonText, _createUserWizard.CreateUserButtonImageUrl, _createUserWizard.CreateUserButtonStyle);
// cancel
- if (Wizard.DisplayCancelButton) {
+ if (Wizard.DisplayCancelButton)
UpdateNavButtonState (Wizard.CancelButtonID + Wizard.CancelButtonType, Wizard.CancelButtonText, Wizard.CancelButtonImageUrl, Wizard.CancelButtonStyle);
- }
- else {
+ else
((Table) Controls [0]).Rows [0].Cells [2].Visible = false;
- }
}
}
if (page != null)
page.VerifyRenderingInServerForm (this);
+ base.AddAttributesToRender (w);
bool enabled = IsEnabled;
string onclick = OnClientClick;
onclick = ClientScriptManager.EnsureEndsWithSemicolon (onclick);
string href = page.ClientScript.GetPostBackEventReference (options, true);
w.AddAttribute (HtmlTextWriterAttribute.Href, href);
}
- base.AddAttributesToRender (w);
+
AddDisplayStyleAttribute (w);
}
return;
// note: avoid calling properties multiple times
- int i = CellPadding;
- if (i != -1)
- writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, i.ToString (Helpers.InvariantCulture), false);
-
- i = CellSpacing;
+ int i = CellSpacing;
if (i != -1) {
writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing, i.ToString (Helpers.InvariantCulture), false);
if (i == 0)
writer.AddStyleAttribute(HtmlTextWriterStyle.BorderCollapse, "collapse");
}
+ i = CellPadding;
+ if (i != -1)
+ writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding, i.ToString (Helpers.InvariantCulture), false);
+
GridLines g = GridLines;
switch (g) {
case GridLines.Horizontal:
using System;
using System.Collections;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Web.UI;
public static readonly string MoveNextCommandName = "MoveNext";
public static readonly string MovePreviousCommandName = "MovePrevious";
public static readonly string MoveToCommandName = "Move";
-
- protected static readonly string CancelButtonID = "CancelButton";
- protected static readonly string CustomFinishButtonID = "CustomFinishButton";
- protected static readonly string CustomNextButtonID = "CustomNextButton";
- protected static readonly string CustomPreviousButtonID = "CustomPreviousButton";
+#if NET_4_0
+ public static readonly string HeaderPlaceholderId = "headerPlaceholder";
+ public static readonly string NavigationPlaceholderId = "navigationPlaceholder";
+ public static readonly string SideBarPlaceholderId = "sideBarPlaceholder";
+ public static readonly string WizardStepPlaceholderId = "wizardStepPlaceholder";
+#endif
protected static readonly string DataListID = "SideBarList";
- protected static readonly string FinishButtonID = "FinishButton";
- protected static readonly string FinishPreviousButtonID = "FinishPreviousButton";
- protected static readonly string SideBarButtonID = "SideBarButton";
- protected static readonly string StartNextButtonID = "StartNextButton";
- protected static readonly string StepNextButtonID = "StepNextButton";
- protected static readonly string StepPreviousButtonID = "StepPreviousButton";
+
+ static readonly string CancelButtonIDShort = "Cancel";
+ protected static readonly string CancelButtonID = CancelButtonIDShort + "Button";
+
+ static readonly string CustomFinishButtonIDShort = "CustomFinish";
+ protected static readonly string CustomFinishButtonID = CustomFinishButtonIDShort + "Button";
+
+ static readonly string CustomNextButtonIDShort = "CustomNext";
+ protected static readonly string CustomNextButtonID = CustomNextButtonIDShort + "Button";
+
+ static readonly string CustomPreviousButtonIDShort = "CustomPrevious";
+ protected static readonly string CustomPreviousButtonID = CustomPreviousButtonIDShort + "Button";
+
+ static readonly string FinishButtonIDShort = "Finish";
+ protected static readonly string FinishButtonID = FinishButtonIDShort + "Button";
+
+ static readonly string FinishPreviousButtonIDShort = "FinishPrevious";
+ protected static readonly string FinishPreviousButtonID = FinishPreviousButtonIDShort + "Button";
+
+ static readonly string SideBarButtonIDShort = "SideBar";
+ protected static readonly string SideBarButtonID = SideBarButtonIDShort + "Button";
+
+ static readonly string StartNextButtonIDShort = "StartNext";
+ protected static readonly string StartNextButtonID = StartNextButtonIDShort + "Button";
+
+ static readonly string StepNextButtonIDShort = "StepNext";
+ protected static readonly string StepNextButtonID = StepNextButtonIDShort + "Button";
+
+ static readonly string StepPreviousButtonIDShort = "StepPrevious";
+ protected static readonly string StepPreviousButtonID = StepPreviousButtonIDShort + "Button";
WizardStepCollection steps;
ITemplate stepNavigationTemplate;
ITemplate headerTemplate;
ITemplate sideBarTemplate;
-
+
// Control state
int activeStepIndex = -1;
if (eh != null) eh (this, e);
}
}
-
+
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
[BrowsableAttribute (false)]
public WizardStepBase ActiveStep {
get {
- if (ActiveStepIndex < -1 || ActiveStepIndex >= WizardSteps.Count)
+ int activeIndex = ActiveStepIndex;
+ if (activeIndex < -1 || activeIndex >= WizardSteps.Count)
throw new InvalidOperationException ("ActiveStepIndex has an invalid value.");
- if (ActiveStepIndex == -1) return null;
- return WizardSteps [activeStepIndex];
+ if (activeIndex == -1)
+ return null;
+ return WizardSteps [activeIndex];
}
}
throw new ArgumentOutOfRangeException ("The ActiveStepIndex must be less than WizardSteps.Count and at least -1");
if (inited && !AllowNavigationToStep (value))
return;
-
+
if(activeStepIndex != value) {
activeStepIndex = value;
ViewState ["HeaderText"] = value;
}
}
-
+#if NET_4_0
+ [DefaultValue (null)]
+ [TemplateContainerAttribute(typeof(Wizard))]
+ [PersistenceModeAttribute(PersistenceMode.InnerProperty)]
+ [BrowsableAttribute(false)]
+ public virtual ITemplate LayoutTemplate { get; set; }
+#endif
[DefaultValueAttribute (null)]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
[NotifyParentPropertyAttribute (true)]
public ICollection GetHistory ()
{
- if (history == null) history = new ArrayList ();
+ if (history == null)
+ history = new ArrayList ();
return history;
}
public void MoveTo (WizardStepBase wizardStep)
{
- if (wizardStep == null) throw new ArgumentNullException ("wizardStep");
+ if (wizardStep == null)
+ throw new ArgumentNullException ("wizardStep");
int i = WizardSteps.IndexOf (wizardStep);
- if (i == -1) throw new ArgumentException ("The provided wizard step does not belong to this wizard.");
+ if (i == -1)
+ throw new ArgumentException ("The provided wizard step does not belong to this wizard.");
ActiveStepIndex = i;
}
protected virtual bool AllowNavigationToStep (int index)
{
- if (index < 0 || index >= WizardSteps.Count) return false;
- if (history == null) return true;
- if (!history.Contains (index)) return true;
+ if ((index < 0 || index >= WizardSteps.Count) || history == null || !history.Contains (index))
+ return true;
+
return WizardSteps [index].AllowReturn;
}
{
CreateControlHierarchy ();
}
+#if NET_4_0
+ InvalidOperationException MakeLayoutException (string phName, string phID, string condition = null)
+ {
+ return new InvalidOperationException (
+ String.Format ("A {0} placeholder must be specified on Wizard '{1}'{2}. Specify a placeholder by setting a control's ID property to \"{3}\". The placeholder control must also specify runat=\"server\"",
+ phName, ID, condition, phID)
+ );
+ }
+
+ void CreateControlHierarchy_LayoutTemplate (ITemplate layoutTemplate)
+ {
+ var layoutContainer = new WizardLayoutContainer ();
+ ControlCollection controls = Controls;
+
+ controls.SetReadonly (false);
+ controls.Add (layoutContainer);
+ controls.SetReadonly (true);
+
+ layoutTemplate.InstantiateIn (layoutContainer);
+
+ WizardStepCollection steps = WizardSteps;
+ bool doRender = steps != null && steps.Count > 0;
+ Control container, placeHolder;
+
+ if (DisplaySideBar) {
+ placeHolder = layoutContainer.FindControl (SideBarPlaceholderId);
+ if (placeHolder == null)
+ throw MakeLayoutException ("sidebar", SideBarPlaceholderId, " when DisplaySideBar is set to true");
+
+ container = new Control ();
+ CreateSideBar (container);
+ ReplacePlaceHolder (layoutContainer, placeHolder, container);
+ }
+
+ ITemplate headerTemplate = HeaderTemplate;
+ if (headerTemplate != null) {
+ placeHolder = layoutContainer.FindControl (HeaderPlaceholderId);
+ if (placeHolder == null)
+ throw MakeLayoutException ("header", HeaderPlaceholderId, " when HeaderTemplate is set");
+
+ container = new Control ();
+ headerTemplate.InstantiateIn (container);
+ ReplacePlaceHolder (layoutContainer, placeHolder, container);
+ }
+
+ placeHolder = layoutContainer.FindControl (WizardStepPlaceholderId);
+ if (placeHolder == null)
+ throw MakeLayoutException ("step", WizardStepPlaceholderId);
+
+ customNavigation = null;
+ multiView = new MultiView ();
+ foreach (View v in steps) {
+ if (v is TemplatedWizardStep)
+ InstantiateTemplateStep ((TemplatedWizardStep) v);
+ multiView.Views.Add (v);
+ }
+ multiView.ActiveViewIndex = ActiveStepIndex;
+ ReplacePlaceHolder (layoutContainer, placeHolder, multiView);
+
+ placeHolder = layoutContainer.FindControl (NavigationPlaceholderId);
+ if (placeHolder == null)
+ throw MakeLayoutException ("navigation", NavigationPlaceholderId);
+
+
+ var contentTable = new Table ();
+ contentTable.CellSpacing = 5;
+ contentTable.CellPadding = 5;
+ var row = new TableRow ();
+ var cell = new TableCell ();
+ cell.HorizontalAlign = HorizontalAlign.Right;
+
+ container = new Control ();
+ CreateButtonBar (container);
+
+ row.Cells.Add (cell);
+ contentTable.Rows.Add (row);
+ ReplacePlaceHolder (layoutContainer, placeHolder, container);
+
+ layoutContainer.Visible = doRender;
+ }
+ void ReplacePlaceHolder (WebControl container, Control placeHolder, Control replacement)
+ {
+ ControlCollection controls = container.Controls;
+ int index = controls.IndexOf (placeHolder);
+ controls.Remove (placeHolder);
+ controls.AddAt (index, replacement);
+ }
+#endif
protected virtual void CreateControlHierarchy ()
{
+#if NET_4_0
+ ITemplate layoutTemplate = LayoutTemplate;
+ if (layoutTemplate != null) {
+ CreateControlHierarchy_LayoutTemplate (layoutTemplate);
+ return;
+ }
+#endif
styles.Clear ();
wizardTable = new ContainedTable (this);
step.CustomNavigationTemplateContainer = customNavigationTemplateContainer;
}
- internal void RegisterCustomNavigation (TemplatedWizardStep step, BaseWizardNavigationContainer customNavigationTemplateContainer) {
+ internal void RegisterCustomNavigation (TemplatedWizardStep step, BaseWizardNavigationContainer customNavigationTemplateContainer)
+ {
if (customNavigation == null)
customNavigation = new Hashtable ();
customNavigation [step] = customNavigationTemplateContainer;
}
- void CreateButtonBar (TableCell buttonBarCell)
+ void CreateButtonBar (Control container)
{
- if(customNavigation!=null && customNavigation.Values.Count>0)
- {
+ if(customNavigation != null && customNavigation.Values.Count > 0 ) {
int i = 0;
foreach (Control customNavigationTemplateContainer in customNavigation.Values) {
- customNavigationTemplateContainer.ID = "CustomNavContainer" + i++;
- buttonBarCell.Controls.Add (customNavigationTemplateContainer);
+ customNavigationTemplateContainer.ID = "CustomNavigationTemplateContainerID" + i++;
+ container.Controls.Add (customNavigationTemplateContainer);
}
}
// StartNavContainer
//
_startNavContainer = new StartNavigationContainer (this);
- _startNavContainer.ID = "StartNavContainer";
- if (startNavigationTemplate != null) {
+ _startNavContainer.ID = "StartNavigationTemplateContainerID";
+ if (startNavigationTemplate != null)
startNavigationTemplate.InstantiateIn (_startNavContainer);
- }
else {
TableRow row;
AddNavButtonsTable (_startNavContainer, out row);
- AddButtonCell (row, CreateButtonSet (StartNextButtonID, MoveNextCommandName));
- AddButtonCell (row, CreateButtonSet (CancelButtonID, CancelCommandName, false));
+ AddButtonCell (row, CreateButtonSet (StartNextButtonIDShort, MoveNextCommandName));
+ AddButtonCell (row, CreateButtonSet (CancelButtonIDShort, CancelCommandName, false));
_startNavContainer.ConfirmDefaultTemplate ();
}
- buttonBarCell.Controls.Add (_startNavContainer);
+ container.Controls.Add (_startNavContainer);
//
// StepNavContainer
//
_stepNavContainer = new StepNavigationContainer (this);
- _stepNavContainer.ID = "StepNavContainer";
- if (stepNavigationTemplate != null) {
+ _stepNavContainer.ID = "StepNavigationTemplateContainerID";
+ if (stepNavigationTemplate != null)
stepNavigationTemplate.InstantiateIn (_stepNavContainer);
- }
else {
TableRow row;
AddNavButtonsTable (_stepNavContainer, out row);
- AddButtonCell (row, CreateButtonSet (StepPreviousButtonID, MovePreviousCommandName, false));
- AddButtonCell (row, CreateButtonSet (StepNextButtonID, MoveNextCommandName));
- AddButtonCell (row, CreateButtonSet (CancelButtonID, CancelCommandName, false));
+ AddButtonCell (row, CreateButtonSet (StepPreviousButtonIDShort, MovePreviousCommandName, false));
+ AddButtonCell (row, CreateButtonSet (StepNextButtonIDShort, MoveNextCommandName));
+ AddButtonCell (row, CreateButtonSet (CancelButtonIDShort, CancelCommandName, false));
_stepNavContainer.ConfirmDefaultTemplate ();
}
- buttonBarCell.Controls.Add (_stepNavContainer);
+ container.Controls.Add (_stepNavContainer);
//
// StepNavContainer
//
_finishNavContainer = new FinishNavigationContainer (this);
- _finishNavContainer.ID = "FinishNavContainer";
- if (finishNavigationTemplate != null) {
+ _finishNavContainer.ID = "FinishNavigationTemplateContainerID";
+ if (finishNavigationTemplate != null)
finishNavigationTemplate.InstantiateIn (_finishNavContainer);
- }
else {
TableRow row;
AddNavButtonsTable (_finishNavContainer, out row);
- AddButtonCell (row, CreateButtonSet (FinishPreviousButtonID, MovePreviousCommandName, false));
- AddButtonCell (row, CreateButtonSet (FinishButtonID, MoveCompleteCommandName));
- AddButtonCell (row, CreateButtonSet (CancelButtonID, CancelCommandName, false));
+ AddButtonCell (row, CreateButtonSet (FinishPreviousButtonIDShort, MovePreviousCommandName, false));
+ AddButtonCell (row, CreateButtonSet (FinishButtonIDShort, MoveCompleteCommandName));
+ AddButtonCell (row, CreateButtonSet (CancelButtonIDShort, CancelCommandName, false));
_finishNavContainer.ConfirmDefaultTemplate ();
}
- buttonBarCell.Controls.Add (_finishNavContainer);
+ container.Controls.Add (_finishNavContainer);
}
static void AddNavButtonsTable (BaseWizardNavigationContainer container, out TableRow row)
CreateButton ( id + ButtonType.Link, command, ButtonType.Link, causesValidation, validationGroup)
};
}
-
+
Control CreateButton (string id, string command, ButtonType type, bool causesValidation, string validationGroup)
{
WebControl b;
switch (type) {
case ButtonType.Button:
- b = CreateStandartButton ();
+ b = CreateStandardButton ();
break;
case ButtonType.Image:
b = CreateImageButton (null);
return b;
}
- WebControl CreateStandartButton () {
+ WebControl CreateStandardButton () {
Button btn = new Button ();
return btn;
}
row.Cells.Add (cell);
}
- void CreateSideBar (TableCell sideBarCell)
+ void CreateSideBar (Control container)
{
- RegisterApplyStyle (sideBarCell, SideBarStyle);
+ WebControl wctl = container as WebControl;
+ if (wctl != null)
+ RegisterApplyStyle (wctl, SideBarStyle);
+
if (sideBarTemplate != null) {
- sideBarTemplate.InstantiateIn (sideBarCell);
- stepDatalist = sideBarCell.FindControl (DataListID) as DataList;
+ sideBarTemplate.InstantiateIn (container);
+ stepDatalist = container.FindControl (DataListID) as DataList;
if (stepDatalist == null)
throw new InvalidOperationException ("The side bar template must contain a DataList control with id '" + DataListID + "'.");
stepDatalist.ItemDataBound += new DataListItemEventHandler(StepDatalistItemDataBound);
stepDatalist.ID = DataListID;
stepDatalist.SelectedItemStyle.Font.Bold = true;
stepDatalist.ItemTemplate = SideBarItemTemplate;
- sideBarCell.Controls.Add (stepDatalist);
+ container.Controls.Add (stepDatalist);
}
stepDatalist.ItemCommand += new DataListCommandEventHandler (StepDatalistItemCommand);
((WebControl) button).Enabled = false;
}
}
-
+
void AddHeaderRow (Table table)
{
TableRow row = new TableRow ();
protected internal override void Render (HtmlTextWriter writer)
{
PrepareControlHierarchy ();
-
- wizardTable.Render (writer);
+#if NET_4_0
+ if (LayoutTemplate == null)
+#endif
+ wizardTable.Render (writer);
+#if NET_4_0
+ else
+ RenderChildren (writer);
+#endif
}
void PrepareControlHierarchy ()
{
- // header
- if (!_headerCell.Initialized) {
- if (String.IsNullOrEmpty (HeaderText))
- _headerCell.Parent.Visible = false;
- else
- _headerCell.Text = HeaderText;
- }
+#if NET_4_0
+ if (LayoutTemplate == null) {
+#endif
+ // header
+ if (!_headerCell.Initialized) {
+ if (String.IsNullOrEmpty (HeaderText))
+ _headerCell.Parent.Visible = false;
+ else
+ _headerCell.Text = HeaderText;
+ }
- if (ActiveStep.StepType == WizardStepType.Complete)
- _headerCell.Parent.Visible = false;
+ if (ActiveStep.StepType == WizardStepType.Complete)
+ _headerCell.Parent.Visible = false;
+#if NET_4_0
+ } else {
+ WizardStepCollection steps = WizardSteps;
+ if (steps == null || steps.Count == 0)
+ return;
+ }
+#endif
+
// sidebar
if (stepDatalist != null) {
stepDatalist.SelectedIndex = ActiveStepIndex;
BaseWizardNavigationContainer currentNavContainer = GetCurrentNavContainer ();
if (currentNavContainer == null) {
- _navigationCell.Parent.Visible = false;
- }
- else {
+ if (_navigationCell != null)
+ _navigationCell.Parent.Visible = false;
+ } else {
currentNavContainer.Visible = true;
currentNavContainer.PrepareControlHierarchy ();
- if (!currentNavContainer.Visible)
+ if (_navigationCell != null && !currentNavContainer.Visible)
_navigationCell.Parent.Visible = false;
}
// next
if (Wizard.AllowNavigationToStep (Wizard.ActiveStepIndex + 1)) {
visible = true;
- UpdateNavButtonState (Wizard.StartNextButtonID + Wizard.StartNextButtonType, Wizard.StartNextButtonText, Wizard.StartNextButtonImageUrl, Wizard.StartNextButtonStyle);
- }
- else {
+ UpdateNavButtonState (Wizard.StartNextButtonIDShort + Wizard.StartNextButtonType, Wizard.StartNextButtonText, Wizard.StartNextButtonImageUrl, Wizard.StartNextButtonStyle);
+ } else
((Table) Controls [0]).Rows [0].Cells [0].Visible = false;
- }
// cancel
if (Wizard.DisplayCancelButton) {
visible = true;
- UpdateNavButtonState (Wizard.CancelButtonID + Wizard.CancelButtonType, Wizard.CancelButtonText, Wizard.CancelButtonImageUrl, Wizard.CancelButtonStyle);
- }
- else {
+ UpdateNavButtonState (Wizard.CancelButtonIDShort + Wizard.CancelButtonType, Wizard.CancelButtonText, Wizard.CancelButtonImageUrl, Wizard.CancelButtonStyle);
+ } else
((Table) Controls [0]).Rows [0].Cells [1].Visible = false;
- }
+
Visible = visible;
}
}
protected override void UpdateState ()
{
bool visible = false;
-
// previous
if (Wizard.AllowNavigationToStep (Wizard.ActiveStepIndex - 1)) {
visible = true;
- UpdateNavButtonState (Wizard.StepPreviousButtonID + Wizard.StepPreviousButtonType, Wizard.StepPreviousButtonText, Wizard.StepPreviousButtonImageUrl, Wizard.StepPreviousButtonStyle);
- }
- else {
+ UpdateNavButtonState (Wizard.StepPreviousButtonIDShort + Wizard.StepPreviousButtonType, Wizard.StepPreviousButtonText, Wizard.StepPreviousButtonImageUrl, Wizard.StepPreviousButtonStyle);
+ } else
((Table) Controls [0]).Rows [0].Cells [0].Visible = false;
- }
// next
if (Wizard.AllowNavigationToStep (Wizard.ActiveStepIndex + 1)) {
visible = true;
- UpdateNavButtonState (Wizard.StepNextButtonID + Wizard.StepNextButtonType, Wizard.StepNextButtonText, Wizard.StepNextButtonImageUrl, Wizard.StepNextButtonStyle);
- }
- else {
+ UpdateNavButtonState (Wizard.StepNextButtonIDShort + Wizard.StepNextButtonType, Wizard.StepNextButtonText, Wizard.StepNextButtonImageUrl, Wizard.StepNextButtonStyle);
+ } else
((Table) Controls [0]).Rows [0].Cells [1].Visible = false;
- }
// cancel
if (Wizard.DisplayCancelButton) {
visible = true;
- UpdateNavButtonState (Wizard.CancelButtonID + Wizard.CancelButtonType, Wizard.CancelButtonText, Wizard.CancelButtonImageUrl, Wizard.CancelButtonStyle);
- }
- else {
+ UpdateNavButtonState (Wizard.CancelButtonIDShort + Wizard.CancelButtonType, Wizard.CancelButtonText, Wizard.CancelButtonImageUrl, Wizard.CancelButtonStyle);
+ } else
((Table) Controls [0]).Rows [0].Cells [2].Visible = false;
- }
+
Visible = visible;
}
}
protected override void UpdateState ()
{
// previous
- if (Wizard.AllowNavigationToStep (Wizard.ActiveStepIndex - 1)) {
- UpdateNavButtonState (Wizard.FinishPreviousButtonID + Wizard.FinishPreviousButtonType, Wizard.FinishPreviousButtonText, Wizard.FinishPreviousButtonImageUrl, Wizard.FinishPreviousButtonStyle);
- }
- else {
+ int previous = Wizard.ActiveStepIndex - 1;
+ if (previous >= 0 && Wizard.AllowNavigationToStep (previous)) {
+ UpdateNavButtonState (Wizard.FinishPreviousButtonIDShort + Wizard.FinishPreviousButtonType, Wizard.FinishPreviousButtonText, Wizard.FinishPreviousButtonImageUrl, Wizard.FinishPreviousButtonStyle);
+ } else
((Table) Controls [0]).Rows [0].Cells [0].Visible = false;
- }
// finish
- UpdateNavButtonState (Wizard.FinishButtonID + Wizard.FinishCompleteButtonType, Wizard.FinishCompleteButtonText, Wizard.FinishCompleteButtonImageUrl, Wizard.FinishCompleteButtonStyle);
+ UpdateNavButtonState (Wizard.FinishButtonIDShort + Wizard.FinishCompleteButtonType, Wizard.FinishCompleteButtonText, Wizard.FinishCompleteButtonImageUrl, Wizard.FinishCompleteButtonStyle);
// cancel
if (Wizard.DisplayCancelButton) {
- UpdateNavButtonState (Wizard.CancelButtonID + Wizard.CancelButtonType, Wizard.CancelButtonText, Wizard.CancelButtonImageUrl, Wizard.CancelButtonStyle);
- }
- else {
+ UpdateNavButtonState (Wizard.CancelButtonIDShort + Wizard.CancelButtonType, Wizard.CancelButtonText, Wizard.CancelButtonImageUrl, Wizard.CancelButtonStyle);
+ } else
((Table) Controls [0]).Rows [0].Cells [2].Visible = false;
- }
}
}
--- /dev/null
+//
+// Authors:
+// Marek Habersack <mhabersack@novell.com>
+//
+// Copyright (C) 2010 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ sealed class WizardLayoutContainer : WebControl
+ {
+ protected internal override void Render (HtmlTextWriter writer)
+ {
+ RenderChildren (writer);
+ }
+ }
+}
--- /dev/null
+//
+// Authors:
+// Marek Habersack <mhabersack@novell.com>
+//
+// Copyright (C) 2010 Novell, Inc (http://novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Web;
+using System.Web.UI;
+
+namespace System.Web.UI.WebControls
+{
+ sealed class WizardLayoutNavigationContainer : WebControl
+ {
+ protected internal override void Render (HtmlTextWriter writer)
+ {
+ RenderChildren (writer);
+ }
+ }
+}
}
if (!haveMyID) {
- sb.Append (myID);
+ if (this is INamingContainer || !AutoID)
+ sb.Append (myID);
+ else {
+ int length = sb.Length;
+ if (length > 0 && sb [length - 1] == separator)
+ sb.Length = length - 1;
+ }
+
return sb.ToString ();
}
using MonoTests.stand_alone.WebHarness;
using System.Threading;
-
+using MonoTests.Common;
namespace MonoTests.System.Web.UI.WebControls
base.EnsureChildControls ();
}
}
+#if NET_4_0
+ class TestHeaderSpan : WebControl
+ {
+ public TestHeaderSpan ()
+ : base (HtmlTextWriterTag.Span)
+ { }
+ }
+ class TestHeaderTemplate : ITemplate
+ {
+ public void InstantiateIn (Control container)
+ {
+ container.Controls.Add (new LiteralControl ("Header"));
+ }
+ }
+
+ class TestLayoutTemplate : ITemplate
+ {
+ public bool HasHeaderPlaceHolder { get; set; }
+ public bool HasNavigationPlaceHolder { get; set; }
+ public bool HasSideBarPlaceHolder { get; set; }
+ public bool HasWizardStepPlaceHolder { get; set; }
+
+ public Type HeaderPlaceHolderType { get; set; }
+ public Type NavigationPlaceHolderType { get; set; }
+ public Type SideBarPlaceHolderType { get; set; }
+ public Type WizardStepPlaceHolderType { get; set; }
+
+ public TestLayoutTemplate ()
+ {
+ HeaderPlaceHolderType = typeof (PlaceHolder);
+ NavigationPlaceHolderType = typeof (PlaceHolder);
+ SideBarPlaceHolderType = typeof (PlaceHolder);
+ WizardStepPlaceHolderType = typeof (PlaceHolder);
+ }
+
+ public void InstantiateIn (Control container)
+ {
+ if (HasHeaderPlaceHolder)
+ container.Controls.Add (MakePlaceHolder (HeaderPlaceHolderType, Wizard.HeaderPlaceholderId));
+
+ if (HasSideBarPlaceHolder)
+ container.Controls.Add (MakePlaceHolder (SideBarPlaceHolderType, Wizard.SideBarPlaceholderId));
+ if (HasNavigationPlaceHolder)
+ container.Controls.Add (MakePlaceHolder (NavigationPlaceHolderType, Wizard.NavigationPlaceholderId));
+
+ if (HasWizardStepPlaceHolder)
+ container.Controls.Add (MakePlaceHolder (WizardStepPlaceHolderType, Wizard.WizardStepPlaceholderId));
+ }
+
+ Control MakePlaceHolder (Type type, string id)
+ {
+ Control ctl = Activator.CreateInstance (type) as Control;
+ if (ctl == null)
+ throw new InvalidOperationException ("Placeholder must descend from the Control type.");
+
+ ctl.ID = id;
+ return ctl;
+ }
+ }
+#endif
[TestFixture]
public class WizardTest
{
Assert.AreEqual ("MoveNext", Wizard.MoveNextCommandName, "MoveNextCommandName");
Assert.AreEqual ("MovePrevious", Wizard.MovePreviousCommandName, "MovePreviousCommandName");
Assert.AreEqual ("Move", Wizard.MoveToCommandName, "MoveToCommandName");
+#if NET_4_0
+ Assert.AreEqual ("headerPlaceholder", Wizard.HeaderPlaceholderId, "HeaderPlaceHolderId");
+ Assert.AreEqual ("navigationPlaceholder", Wizard.NavigationPlaceholderId, "NavigationPlaceHolderId");
+ Assert.AreEqual ("sideBarPlaceholder", Wizard.SideBarPlaceholderId, "SidePlaceholderId");
+ Assert.AreEqual ("wizardStepPlaceholder", Wizard.WizardStepPlaceholderId, "WizardStepPlaceholderId");
+#endif
// Protected Fields
Assert.AreEqual ("CancelButton", PokerWizard.PokerCancelButtonID, "CancelButtonID");
Assert.AreEqual ("CustomFinishButton", PokerWizard.PokerCustomFinishButtonID, "CustomFinishButtonID");
Assert.AreEqual (false, result, "AllowNavigationToStep#2");
}
+ [Test]
+ public void Wizard_AllowNavigationToStep_NoIndexCheck ()
+ {
+ PokerWizard wizard = new PokerWizard ();
+ Assert.IsTrue (wizard.PokerAllowNavigationToStep (0), "#A1-1");
+ Assert.IsTrue (wizard.PokerAllowNavigationToStep (10), "#A1-2");
+ Assert.IsTrue (wizard.PokerAllowNavigationToStep (-10), "#A1-3");
+ }
+
[Test]
public void Wizard_CreateControlCollection ()
{
Assert.Fail ("FinishButtonNotCreated");
Assert.AreEqual (-1, result.IndexOf ("Next"), "NextButtonCreatedOnLastPage");
}
+#if NET_4_0
+ [Test]
+ public void Wizard_LayoutTemplate ()
+ {
+ var w = new Wizard ();
+
+ Assert.IsNull (w.LayoutTemplate, "#A1");
+ }
+
+ [Test]
+ public void Wizard_LayoutTemplate_Empty ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
+ t.UserData = "Empty";
+ string result;
+
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ result = t.Run ();
+ }, "#A1");
+ }
+ [Test]
+ public void Wizard_LayoutTemplate_OptionalSideBar ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
+ t.UserData = "OptionalSideBar_NoSideBar";
+ string result = t.Run ();
+ string renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
+
+ Assert.AreEqual (String.Empty, renderedHtml, "#A1");
+
+ t.UserData = "OptionalSideBar_WithSideBar";
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ result = t.Run ();
+ }, "#A2");
+ }
+
+ [Test]
+ public void Wizard_LayoutTemplate_RenderSideBar ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
+ t.UserData = "RenderSideBar";
+ string result = t.Run ();
+#if DOT_NET
+ string origHtml = "<table id=\"MyWizard_SideBarList\" cellspacing=\"0\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td style=\"font-weight:bold;\"><a id=\"MyWizard_SideBarList_SideBarButton_0\" href=\"javascript:__doPostBack('MyWizard$SideBarList$ctl00$SideBarButton','')\">step1</a></td>\r\n\t</tr>\r\n</table><table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
+#else
+ string origHtml = "<table id=\"MyWizard_SideBarList\" cellspacing=\"0\" style=\"border-collapse:collapse;\">\r\n\t<tr>\r\n\t\t<td style=\"font-weight:bold;\"><a id=\"MyWizard_SideBarList_ctl00_SideBarButton_0\" href=\"javascript:__doPostBack('MyWizard$SideBarList$ctl00$SideBarButton','')\">step1</a></td>\r\n\t</tr>\r\n</table><table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
+#endif
+ string renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
+ Console.WriteLine (origHtml);
+ Console.WriteLine ("----------------------------");
+ Console.WriteLine (renderedHtml);
+
+ Assert.AreEqual (origHtml, renderedHtml, "#A1");
+ }
+
+ [Test]
+ public void Wizard_LayoutTemplate_OptionalHeader ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
+ t.UserData = "OptionalHeader_NoHeaderTemplate";
+ string result = t.Run ();
+ string renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
+
+ Assert.AreEqual (String.Empty, renderedHtml, "#A1");
+
+ t.UserData = "OptionalHeader_WithHeaderTemplate";
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ result = t.Run ();
+ }, "#A2");
+ }
+
+ [Test]
+ public void Wizard_LayoutTemplate_RenderHeader ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
+ t.UserData = "RenderHeader";
+ string result = t.Run ();
+ string origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
+ string renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
+
+ Assert.AreEqual (origHtml, renderedHtml, "#A1");
+
+ t.UserData = "RenderHeader_InSpan";
+ result = t.Run ();
+ origHtml = "Header<table cellspacing=\"5\" cellpadding=\"5\">\r\n\t<tr>\r\n\t\t<td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepPreviousButton\" value=\"Previous\" id=\"MyWizard_StepNavigationTemplateContainerID_StepPreviousButton\" /></td><td align=\"right\"><input type=\"submit\" name=\"MyWizard$StepNavigationTemplateContainerID$StepNextButton\" value=\"Next\" id=\"MyWizard_StepNavigationTemplateContainerID_StepNextButton\" /></td>\r\n\t</tr>\r\n</table>Step";
+ renderedHtml = HtmlDiff.GetControlFromPageHtml (result);
+ Assert.AreEqual (origHtml, renderedHtml, "#A2");
+ }
+
+ [Test]
+ public void Wizard_LayoutTemplate_StepPlaceHolder ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
+ t.UserData = "StepPlaceHolder";
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ string result = t.Run ();
+ }, "#A1");
+ }
+
+ [Test]
+ public void Wizard_LayoutTemplate_NavigationPlaceHolder ()
+ {
+ WebTest t = new WebTest (PageInvoker.CreateOnInit (LayoutTemplateRender));
+ t.UserData = "NavigationPlaceHolder";
+ AssertExtensions.Throws<InvalidOperationException> (() => {
+ string result = t.Run ();
+ }, "#A1");
+ }
+
+ public static void LayoutTemplateRender (Page p)
+ {
+ var w = new Wizard ();
+ w.ID = "MyWizard";
+ WebTest curTest = WebTest.CurrentTest;
+ string id = (string)curTest.UserData;
+
+ switch (id) {
+ case "Empty":
+ w.LayoutTemplate = new TestLayoutTemplate ();
+ break;
+
+ case "OptionalSideBar_NoSideBar":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasHeaderPlaceHolder = true,
+ HasNavigationPlaceHolder = true,
+ HasWizardStepPlaceHolder = true
+ };
+ w.DisplaySideBar = false;
+ break;
+
+ case "OptionalSideBar_WithSideBar":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasHeaderPlaceHolder = true,
+ HasNavigationPlaceHolder = true,
+ HasWizardStepPlaceHolder = true
+ };
+ w.DisplaySideBar = true;
+ break;
+
+ case "RenderSideBar":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasHeaderPlaceHolder = true,
+ HasNavigationPlaceHolder = true,
+ HasWizardStepPlaceHolder = true,
+ HasSideBarPlaceHolder = true
+ };
+ AddWizardStep (w, "Step", "step1");
+ break;
+
+ case "OptionalHeader_NoHeaderTemplate":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasNavigationPlaceHolder = true,
+ HasWizardStepPlaceHolder = true
+ };
+ w.DisplaySideBar = false;
+ break;
+
+ case "OptionalHeader_WithHeaderTemplate":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasNavigationPlaceHolder = true,
+ HasWizardStepPlaceHolder = true
+ };
+ w.HeaderTemplate = new TestHeaderTemplate ();
+ w.DisplaySideBar = false;
+ break;
+
+ case "RenderHeader":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasNavigationPlaceHolder = true,
+ HasWizardStepPlaceHolder = true,
+ HasHeaderPlaceHolder = true
+ };
+ w.HeaderTemplate = new TestHeaderTemplate ();
+ w.DisplaySideBar = false;
+ AddWizardStep (w, "Step", "step1");
+ break;
+
+ case "RenderHeader_InSpan":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasNavigationPlaceHolder = true,
+ HasWizardStepPlaceHolder = true,
+ HasHeaderPlaceHolder = true,
+ HeaderPlaceHolderType = typeof (TestHeaderSpan)
+ };
+ w.HeaderTemplate = new TestHeaderTemplate ();
+ w.DisplaySideBar = false;
+ AddWizardStep (w, "Step", "step1");
+ break;
+
+ case "StepPlaceHolder":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasNavigationPlaceHolder = true,
+ };
+ w.DisplaySideBar = false;
+ break;
+
+ case "NavigationPlaceHolder":
+ w.LayoutTemplate = new TestLayoutTemplate {
+ HasWizardStepPlaceHolder = true,
+ };
+ w.DisplaySideBar = false;
+ break;
+
+ default:
+ throw new InvalidOperationException ("Unknown id '" + id + "'");
+ }
+
+ p.Form.Controls.Add (new LiteralControl (HtmlDiff.BEGIN_TAG));
+ p.Form.Controls.Add (w);
+ p.Form.Controls.Add (new LiteralControl (HtmlDiff.END_TAG));
+ }
+
+ static void AddWizardStep (Wizard w, string stepText, string stepID, WizardStepType type = WizardStepType.Step)
+ {
+ var ws = new WizardStep ();
+ ws.ID = stepID;
+ ws.StepType = type;
+ ws.Controls.Add (new LiteralControl (stepText));
+
+ w.WizardSteps.Add (ws);
+ }
+#endif
[Test]
[Category ("NunitWeb")]
public void Wizard_RenderTestCompleteItem ()
FormRequest fr = new FormRequest (t.Response, "form1");
//Cancel
-#if DOT_NET
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("Wizard1$StartNavigationTemplateContainerID$CancelButton");
- fr.Controls["__EVENTTARGET"].Value = "";
- fr.Controls["__EVENTARGUMENT"].Value = "";
- fr.Controls["Wizard1$StartNavigationTemplateContainerID$CancelButton"].Value = "Cancel";
-#else
- fr.Controls.Add ("__EVENTTARGET");
- fr.Controls.Add ("__EVENTARGUMENT");
- fr.Controls.Add ("Wizard1$StartNavContainer$CancelButtonButton");
fr.Controls ["__EVENTTARGET"].Value = "";
fr.Controls ["__EVENTARGUMENT"].Value = "";
- fr.Controls ["Wizard1$StartNavContainer$CancelButtonButton"].Value = "Cancel";
-#endif
+ fr.Controls ["Wizard1$StartNavigationTemplateContainerID$CancelButton"].Value = "Cancel";
+
t.Request = fr;
html = t.Run ();
Assert.AreEqual ("CancelButtonClick", t.UserData.ToString (), "Cancel");
// Next
-#if DOT_NET
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("Wizard1$StartNavigationTemplateContainerID$StartNextButton");
fr.Controls["__EVENTTARGET"].Value = "";
fr.Controls["__EVENTARGUMENT"].Value = "";
fr.Controls["Wizard1$StartNavigationTemplateContainerID$StartNextButton"].Value = "Next";
-#else
- fr.Controls.Add ("__EVENTTARGET");
- fr.Controls.Add ("__EVENTARGUMENT");
- fr.Controls.Add ("Wizard1$StartNavContainer$StartNextButtonButton");
- fr.Controls["__EVENTTARGET"].Value = "";
- fr.Controls["__EVENTARGUMENT"].Value = "";
- fr.Controls ["Wizard1$StartNavContainer$StartNextButtonButton"].Value = "Next";
-#endif
+
t.Request = fr;
html = t.Run ();
Assert.AreEqual ("NextButtonClick", t.UserData.ToString (), "Next");
// Previous
fr = new FormRequest (t.Response, "form1");
-#if DOT_NET
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("Wizard1$FinishNavigationTemplateContainerID$FinishPreviousButton");
fr.Controls["__EVENTTARGET"].Value = "";
fr.Controls["__EVENTARGUMENT"].Value = "";
fr.Controls["Wizard1$FinishNavigationTemplateContainerID$FinishPreviousButton"].Value = "Previous";
-#else
- fr.Controls.Add ("__EVENTTARGET");
- fr.Controls.Add ("__EVENTARGUMENT");
- fr.Controls.Add ("Wizard1$FinishNavContainer$FinishPreviousButtonButton");
- fr.Controls ["__EVENTTARGET"].Value = "";
- fr.Controls ["__EVENTARGUMENT"].Value = "";
- fr.Controls ["Wizard1$FinishNavContainer$FinishPreviousButtonButton"].Value = "Previous";
-#endif
t.Request = fr;
html = t.Run ();
Assert.AreEqual ("PreviousButtonClick", t.UserData.ToString (), "Previous");
FormRequest fr = new FormRequest (t.Response, "form1");
// Next
-#if DOT_NET
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("Wizard1$StartNavigationTemplateContainerID$StartNextButton");
fr.Controls["__EVENTTARGET"].Value = "";
fr.Controls["__EVENTARGUMENT"].Value = "";
fr.Controls["Wizard1$StartNavigationTemplateContainerID$StartNextButton"].Value = "Next";
-#else
- fr.Controls.Add ("__EVENTTARGET");
- fr.Controls.Add ("__EVENTARGUMENT");
- fr.Controls.Add ("Wizard1$StartNavContainer$StartNextButtonButton");
- fr.Controls ["__EVENTTARGET"].Value = "";
- fr.Controls ["__EVENTARGUMENT"].Value = "";
- fr.Controls ["Wizard1$StartNavContainer$StartNextButtonButton"].Value = "Next";
-#endif
t.Request = fr;
html = t.Run ();
Assert.AreEqual ("NextButtonClick", t.UserData.ToString (), "Next");
// Finish
fr = new FormRequest (t.Response, "form1");
-#if DOT_NET
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls.Add ("Wizard1$FinishNavigationTemplateContainerID$FinishButton");
fr.Controls["__EVENTTARGET"].Value = "";
fr.Controls["__EVENTARGUMENT"].Value = "";
fr.Controls["Wizard1$FinishNavigationTemplateContainerID$FinishButton"].Value = "Finish";
-#else
- fr.Controls.Add ("__EVENTTARGET");
- fr.Controls.Add ("__EVENTARGUMENT");
- fr.Controls.Add ("Wizard1$FinishNavContainer$FinishButtonButton");
- fr.Controls ["__EVENTTARGET"].Value = "";
- fr.Controls ["__EVENTARGUMENT"].Value = "";
- fr.Controls ["Wizard1$FinishNavContainer$FinishButtonButton"].Value = "Finish";
-#endif
t.Request = fr;
t.Run ();
Assert.AreEqual ("FinishButtonClick", t.UserData.ToString (), "Finish");
//SideBarButton
fr = new FormRequest (t.Response, "form1");
-#if DOT_NET
- fr.Controls.Add ("__EVENTTARGET");
- fr.Controls.Add ("__EVENTARGUMENT");
-
- fr.Controls["__EVENTTARGET"].Value = "Wizard1$SideBarContainer$SideBarList$ctl01$SideBarButton";
- fr.Controls["__EVENTARGUMENT"].Value = "";
-#else
fr.Controls.Add ("__EVENTTARGET");
fr.Controls.Add ("__EVENTARGUMENT");
fr.Controls ["__EVENTTARGET"].Value = "Wizard1$SideBarContainer$SideBarList$ctl01$SideBarButton";
fr.Controls ["__EVENTARGUMENT"].Value = "";
-#endif
t.Request = fr;
html = t.Run ();
Assert.AreEqual ("SideBarButtonClick", t.UserData.ToString (), "SideBarButton");
System.Web.UI.WebControls/IFieldControl.cs
System.Web.UI.WebControls/IRenderOuterTable.cs
System.Web.UI.WebControls/RouteParameter.cs
+System.Web.UI.WebControls/WizardLayoutContainer.cs
+System.Web.UI.WebControls/WizardLayoutNavigationContainer.cs
System.Web.Util/RequestValidationSource.cs
System.Web.Util/RequestValidator.cs