Changing Next button text for wizard step.

M

M. Ali Qureshi

Hi,

I have a wizard in my aspx page, and i create steps programatically. There
are about 8 steps in all. The default text for StepNextButton is "Next". But
i want that only in step 4, the next button text should be changed to
something else. For example, "Continue to step 5". Is it possible? Here is
my code for generating steps:

==============================
Protected Sub HitRaterWiz_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles HitRaterWiz.Init
Dim CatAdapter As New
HitRaterTableAdapters.QuestionCategoriesTableAdapter()
Dim DataTable As HitRater.QuestionCategoriesDataTable =
CatAdapter.GetData()
Dim row As HitRater.QuestionCategoriesRow
Dim Counter As Integer = 1
For Each row In DataTable
Dim CatStep As New WizardStep
CatStep.AllowReturn = True
Dim CatHeading As New Literal
CatHeading.Text = "<div class=""CatHeading"">" &
row.QuestionCategory.ToString() & "</div>"
CatStep.Controls.AddAt(0, CatHeading)
CatStep.Controls.AddAt(1,
GetQuestionsTable(row.QuestionCategoryID))
HitRaterWiz.WizardSteps.Add(CatStep)
Counter += 1
Next
End Sub
==============================

Thanks for help.

Rgds.
 
O

oroussea

Hi,

I have a wizard in my aspx page, and i create steps programatically. There
are about 8 steps in all. The default text for StepNextButton is "Next". But
i want that only in step 4, the next button text should be changed to
something else. For example, "Continue to step 5". Is it possible? Here is
my code for generating steps:

==============================
    Protected Sub HitRaterWiz_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles HitRaterWiz.Init
        Dim CatAdapter As New
HitRaterTableAdapters.QuestionCategoriesTableAdapter()
        Dim DataTable As HitRater.QuestionCategoriesDataTable =
CatAdapter.GetData()
        Dim row As HitRater.QuestionCategoriesRow
        Dim Counter As Integer = 1
        For Each row In DataTable
            Dim CatStep As New WizardStep
            CatStep.AllowReturn = True
            Dim CatHeading As New Literal
            CatHeading.Text = "<div class=""CatHeading"">" &
row.QuestionCategory.ToString() & "</div>"
            CatStep.Controls.AddAt(0, CatHeading)
            CatStep.Controls.AddAt(1,
GetQuestionsTable(row.QuestionCategoryID))
            HitRaterWiz.WizardSteps.Add(CatStep)
            Counter += 1
        Next
    End Sub
==============================

Thanks for help.

Rgds.

Have you tried changing stepNextButtonText depending on the current
step?

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.wizard.stepnextbuttontext.aspx
 
M

M. Ali Qureshi

Hi,

I created a test page and tried following very simple wizard, but it didnt
work:

===========================
Protected Sub Wizard1_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Wizard1.Init
For i As Integer = 1 To 8
Dim CatStep As New WizardStep
Dim CatLabel As New Label
CatLabel.Text = "Step nr.: " & i.ToString()
CatStep.Controls.AddAt(0, CatLabel)
If i = 4 Then
Wizard1.StepNextButtonText = "Go to next step"
Else
Wizard1.StepNextButtonText = "Next"
End If
Wizard1.WizardSteps.Add(CatStep)
Next
End Sub
==========================

Any idea?



Hi,

I have a wizard in my aspx page, and i create steps programatically. There
are about 8 steps in all. The default text for StepNextButton is "Next".
But
i want that only in step 4, the next button text should be changed to
something else. For example, "Continue to step 5". Is it possible? Here is
my code for generating steps:

==============================
Protected Sub HitRaterWiz_Init(ByVal sender As Object, ByVal e As
System.EventArgs) Handles HitRaterWiz.Init
Dim CatAdapter As New
HitRaterTableAdapters.QuestionCategoriesTableAdapter()
Dim DataTable As HitRater.QuestionCategoriesDataTable =
CatAdapter.GetData()
Dim row As HitRater.QuestionCategoriesRow
Dim Counter As Integer = 1
For Each row In DataTable
Dim CatStep As New WizardStep
CatStep.AllowReturn = True
Dim CatHeading As New Literal
CatHeading.Text = "<div class=""CatHeading"">" &
row.QuestionCategory.ToString() & "</div>"
CatStep.Controls.AddAt(0, CatHeading)
CatStep.Controls.AddAt(1,
GetQuestionsTable(row.QuestionCategoryID))
HitRaterWiz.WizardSteps.Add(CatStep)
Counter += 1
Next
End Sub
==============================

Thanks for help.

Rgds.

Have you tried changing stepNextButtonText depending on the current
step?

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.wizard.stepnextbuttontext.aspx
 
O

oroussea

Yeah... you could handle the OnActiveStepChanged event like this:

<asp:Wizard ID="Wizard1" Runat="server"
OnActiveStepChanged="OnActiveStepChanged"></asp:Wizard>

Sub OnActiveStepChanged(ByVal sender As Object, ByVal e As EventArgs)
' If the ActiveStep is changing to Step2 check to see if the
' CheckBox1 CheckBox is checked. If it is then skip
' to the Step3 step.

If Wizard1.ActiveStepIndex = 5 Then
Wizard1.StepNextButtonText = "Continue to step 5"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top