We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Wizard: adding pages dynamically

I am using the Wizard control from the Essential Suite 3.0.1.0 package. I am dynamically adding pages to the wizard, but i need to *insert* them, not just add them on the end of the collection, but the WizardContainer does not expose a method to insert them, only add. Is there a way this should be done? I want to avoid having to mess with the NextPage/PreviousPage properties as this is messy to do at run time, and is very hard to maintain.

6 Replies

MJ Mano J Syncfusion Team October 6, 2005 05:20 AM UTC

Hi, There is no available methods to insert a wizard page. If you have to insert a wizard page, assign the NextPage and PreviousPage for that particluar page and insert it in the WizardPageCollection. Please refer to the code snippet below: private void Form1_Load(object sender, System.EventArgs e) { extraWizardControlPage = new Syncfusion.Windows.Forms.Tools.WizardControlPage(); extraWizardControlPage.Description = "This is the description of the extra Wizard Page"; extraWizardControlPage.Title = "Extra Page Title"; extraWizardControlPage.NextPage = this.wizardControlPage5; extraWizardControlPage.PreviousPage = this.wizardControlPage4; } // Add the page in the place where you want to insert in the Initialize component. this.wizardControl1.WizardPages = new Syncfusion.Windows.Forms.Tools.WizardControlPage[] { this.wizardControlPage1, this.wizardControlPage3, this.wizardControlPage4, // Insert the new page this.extraWizardControlPage, this.wizardControlPage5, this.wizardControlPage6 }; Please let me know if you have any questions. Thanks for using Syncfusion products. Regards, Mano


AD Administrator Syncfusion Team October 6, 2005 08:31 PM UTC

Hi Mano, thanks for the reply. I like the Wizard control, but it still has a few bugs and quirks which i need to work around. I have come up with another solution to this problem which i will share here in case it helps someone in the future. - in the designer i assign a TabIndex to all pages in the order they go in, leaving a gap in the numbering at the point where i want to insert pages - at run time create the dynamic page(s), assign them a TabIndex in the empty part of the range - after adding all dynamic pages, i do a sort on the WizardControlPage array at WizardControl.WizardPages, sorting the pages there in order of their TabIndex. Of course i should mention that this suits my needs because i have a linear flow of pages in the wizard, i don''t need to skip any, which means i can avoid using the NextPage/PreviousPage properties. Maybe you could submit a feature request to the developers for them to introduce an Insert function, because only having the Add is somewhat limiting. Regards, sluggy >There is no available methods to insert a wizard page. If you have to insert a wizard page, assign the NextPage and PreviousPage for that particluar page and insert it in the WizardPageCollection.


BH Bob Hogan November 4, 2005 03:46 PM UTC

The handling of NextPage and PreviousPage really seems to be kind of brain-damaged. A VERY common thing to do in a wizard is to change the flow of pages depending on the data entered on a page. The natural thing to do is to add all your pages to the WizardControl at initialization time, then dynamically modify the NextPage/PreviousPage according to THE NEEDS OF THE APPLICATION. But this appears to be almost impossible with Syncfusion''s WizardControl. At least I can''t seem to make it work. I get all kinds of weird page skipping behavior when I try to do this. I invite you to prove me wrong.


MJ Mano J Syncfusion Team November 7, 2005 02:34 PM UTC

Hi Bob, Our wizard control uses WizardControlPage.NextPage and WizardControlPage.PreviousPage properties to arrange the sequence of WizardControlPages in the desired order. Regarding changing the wizard pages according to the datas entered on the pages, you could validate that page and set the desired page to be displayed when the next button is clicked. Please refer to the sample attached and let me know whether I have missed something. Regards, Mano test_wizard.zip


AS Asit Sinha December 10, 2007 03:06 PM UTC

Dear Sir,

I am facing a problem in WizardControl. According to the requirement, dynamic wizard page needs to be added in the wizard control but is not being shown after clicking the previous page.

Below is the wizard control code that I am using.

In this code, NewWizardControlpage is added and shown after the WizardControlPage4 next click, but this code isn’t working.

Please reply immediate.

Thanks & Regards,
Asit Sinha
(YSPL,Pune)


Code
Dim NewWizardControlPage As New Syncfusion.Windows.Forms.Tools.WizardControlPage
NewWizardControlPage = New Syncfusion.Windows.Forms.Tools.WizardControlPage(Me.components)
CType(NewWizardControlPage, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()

NewWizardControlPage.BackgroundColor = New Syncfusion.Drawing.BrushInfo
NewWizardControlPage.BorderColor = System.Drawing.Color.Black
NewWizardControlPage.BorderStyle = System.Windows.Forms.BorderStyle.None
NewWizardControlPage.Description = "New Page"
NewWizardControlPage.FullPage = False
NewWizardControlPage.LayoutName = "Card5"
NewWizardControlPage.Location = New System.Drawing.Point(0, 0)
NewWizardControlPage.Name = "NewWizardControlPage "
NewWizardControlPage.PreviousPage = WizardControlPage4
NewWizardControlPage.Size = New System.Drawing.Size(520, 446)
NewWizardControlPage.TabIndex = 14
NewWizardControlPage.Title = "Page Title"
WizardControlPage4.NextPage = Nothing
WizardControlPage4.NextPage = NewWizardControlPage

CType(NewWizardControlPage, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)

Me.WizardContainer1.Controls.Add(NewWizardControlPage)




BP Bhuvaneswari P Syncfusion Team December 27, 2007 11:07 AM UTC

Hi Asit,

Thanks for the update and code snippet:

Adding pages dynamically to the WizardControl

Please refer the below modified code snippet to do so:

VB

Dim temp As WizardControlPage = Me.wizardControl1.SelectedWizardPage
'Add new page
Dim wizPage As New WizardControlPage()
'Add the page into wizardcontrol
wizardControl1.AddPage(wizPage)
wizPage.Description = "This page is added at runtime"
wizPage.Title = "Dynamic Page"
wizPage.PreviousPage = Me.wizardControlPage5
wizPage.NextPage = Me.wizardControlPage1
Me.wizardControl1.SelectedWizardPage = temp

Please download the sample from the below location:
http://websamples.syncfusion.com/samples/Tools.Windows/F35650/main.htm

Please let me know if you have any other questions.

Best Regards,
Bhuvana


Loader.
Live Chat Icon For mobile
Up arrow icon