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

Dynamically Adding Pages to WizardControl

I have been writing a simple prototype with 1.6.1.0 and the new WizardControl. Is there any wa to programmatically add a page to the WizardControl? The only way I see to add a page is through the designer at design time. I need to do it at runtime. It seems that the list of WizardPages is an array and thus does not allow me to add a page as if it were an aarraylist. Thanks.

6 Replies

AD Administrator Syncfusion Team July 29, 2003 11:28 AM UTC

Hi Steven, There are two ways for changing the order of the pages. 1. By changing the sequence in which the WizardControlPages are added to WizardContainer For instance, in the WizardControlDemo, the pages are added as follows: this.wizardContainer1.Controls.AddRange(new System.Windows.Forms.Control[] { this.wizardControlPage1, this.wizardControlPage3, this.wizardControlPage4, this.wizardControlPage5, this.wizardControlPage6 }); You can reorder them and get the desired sequence. 2. This can also be done using the designer, by right clicking on the form and using the "bring to front" and "send to back" options. "Bring to front" sets that particular page as the first page in the list of pages and "send to back" sets it as the last page in the list. Regards, Guru Patwal.


AD Administrator Syncfusion Team July 30, 2003 01:43 PM UTC

Hi Steven, This is one of the ways to change the order of pages at runtime. You could have buttons like "send to back" and "bring to front" on the page. When the button is clicked, this event can be handled by calling the "SendToBack" or "BringToFront" methods appropriately, which would then reorder the pages at runtime. Regards, Guru Patwal.


SD Steven Domingue August 28, 2003 04:28 PM UTC

I do not want to reorder the pages, I want to add new ones at run-time. The list of WizardPages is an array not an arraylist so it cannot be expanded. ANy ideas?


AD Administrator Syncfusion Team September 7, 2003 03:40 AM UTC

Hi Steven, Please take a look at the sample code attached. I have modified the existing WizardControlDemo sample to facilitate additon of a wizard page at runtime. In this sample, I have handled the button clicked event (for the "Add Page" button on the first wizard page) to generate a new page at the end of the current set of pages. Please let me know if this is the information you are looking for. Thanks, Guru Patwal.


CB Cody Barnes November 14, 2007 07:47 PM UTC

Guru,
I cannot find the attachment that you mention. I am trying to do the same thing as Steven and I am getting into problems where the current SelectedWizardPage changes when a new page is added. How do I prevent this?

>Hi Steven,
>
>Please take a look at the sample code attached. I have modified the existing WizardControlDemo sample to facilitate additon of a wizard page at runtime. In this sample, I have handled the button clicked event (for the "Add Page" button on the first wizard page) to generate a new page at the end of the current set of pages. Please let me know if this is the information you are looking for.
>
>Thanks,
>Guru Patwal.



J. J.Nagarajan Syncfusion Team December 28, 2007 11:48 PM UTC

Hi Cody ,

Sorry for the long delay in getting back to you. You can achieve this behavior in our latest version. We have implemented a lot of features and bug fixes in v.6.1. I would like to recommend you to upgrade to this version.

http://www.syncfusion.com/downloads/latestversion/default.aspx

Unlock key :
Please contact your Syncfusion Sales Representative or e-mail salessupport@syncfusion.com.

You have to capture the currently selected WizardControlPage before adding the new page and then restore it after adding the new page. Please refer to the following code snippet.


WizardControlPage temp = this.wizardControl1.SelectedWizardPage;

WizardControlPage wizPage = new WizardControlPage();
wizardControl1.AddPage(wizPage);
wizPage.Description = "This page is added at runtime";
wizPage.Title = "Dynamic Page";

this.wizardControl1.SelectedWizardPage = temp;

Please refer the sample in the link to illustrate this:
http://websamples.syncfusion.com/samples/Tools.Windows/F5935/main.htm

Please try this and let me know if this helps.

Regards,
Nagaraj


Loader.
Live Chat Icon For mobile
Up arrow icon