Restarting/Looping a Wizard Control

6 posts, 0 answers
  1. Vikas Sharma
    Vikas Sharma avatar
    4 posts
    Member since:
    Dec 2005

    Posted 04 Dec 2006 Link to this post

    Hi!

    I wanted to know if you guys have come across a situation where you had to restart (Loop through) a Wizard control multiple times. I have a Wizard control that I would like to restart, once the user clicks on the finish button. the number of times the Wizard control is restarted, can be based on a value retreived from a session variable or a input textbox.

    Any ideas would be highly appreciated.

    Regards

    Vik
  2. Rumen
    Admin
    Rumen avatar
    1536 posts

    Posted 04 Dec 2006 Link to this post

    Hello Vikas,

    You can reset the Wizard control to the initial page by setting the ActiveStepIndex property of the wizard to 0.

    MSDN Example and sample code:
    http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.wizard.activestepindex.aspx

    All the best,
    Rumen Stankov (MCSD.NET)
    the telerik team
  3. Vikas Sharma
    Vikas Sharma avatar
    4 posts
    Member since:
    Dec 2005

    Posted 04 Dec 2006 Link to this post

    Thanks for the prompt reply Rumen.

    I was aware of the ActiveStepIndex property and did try using it. How can I get the Wizard to loop a certain number of times though?

    Regards

    Vik
  4. Rumen
    Admin
    Rumen avatar
    1536 posts

    Posted 05 Dec 2006 Link to this post

    Hi Vikas,

    This really depends on your scenario. I can suggest using a counter stored in the Session - this way the counter will get incremented each time (and will not be reset after postback).

    ...
    int counter = (int) Session["wizardCounter"];
    counter++;
    Session["wizzardCounter"] = counter;
    ...

    All the best,
    Rumen Stankov (MCSD.NET)
    the telerik team
  5. Vikas Sharma
    Vikas Sharma avatar
    4 posts
    Member since:
    Dec 2005

    Posted 05 Dec 2006 Link to this post

    Thanks for the prompt reply once again Rumen.

    I can store it as session variable and then perhaps loop through it. What would the code look like in VB.NET? Lets say if the session had a value of 3, how can I get the Wizard to loop 3 times only?

    Much appreciate your help.

    Regards

    Vik 
  6. Rumen
    Admin
    Rumen avatar
    1536 posts

    Posted 05 Dec 2006 Link to this post

    Hello Vikas,

    ...
    Dim counter As Integer = CType(Session("wizardCounter"), Integer)
    counter = counter + 1
    If Counter < 3
        ' loop
    Else
        ' do not loop
    EndIF

    Session("wizardCounter") = counter
    ...


    Best wishes,
    Rumen Stankov (MCSD.NET)
    the telerik team
Back to Top