Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 99250

dynamic step content addhandler problem

$
0
0

Hi,

 

I have set up a small testpage to show my problem: When i Click on [Generate wizardsteps] the steps are created and [Next step] is working. When I click the [Generate wizardsteps] button again the steps are re-created, but I have to hit a [Next step] button twice in order to go to a next step. What could cause this behavior?

 

Here is my page code:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test2.aspx.vb" Inherits="test2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    

            <telerik:RadScriptManager runat="server"></telerik:RadScriptManager>


         <telerik:RadButton RenderMode="Lightweight" runat="server" ID="RadButton1" Text="Generate wizardsteps" OnClick="RadButton1_Click"></telerik:RadButton>


        <telerik:RadWizard DisplayNavigationButtons="false" OnWizardStepCreated="RadWizard1_WizardStepCreated" RenderMode="Lightweight" runat="server" ID="RadWizard1" Height="360px">
          
        </telerik:RadWizard>

    </div>
    </form>
</body>
</html>

and this is the code-behind:

Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI

Partial Public Class test2
    Inherits System.Web.UI.Page

    Protected Sub RadButton1_Click(sender As Object, e As EventArgs)

        RadWizard1.WizardSteps.Clear()

        For i As Integer = 0 To 4
            Dim [step] As New RadWizardStep()
            [step].ID = "Step " + (i + 1).ToString()
            RadWizard1.WizardSteps.Add([step])
        Next
        Dim completeStep As New RadWizardStep()
        completeStep.ID = "Complete"
        RadWizard1.WizardSteps.Add(completeStep)

        RadWizard1.ActiveStepIndex = RadWizard1.WizardSteps(0).Index

    End Sub


    Protected Sub RadWizard1_WizardStepCreated(sender As Object, e As WizardStepCreatedEventArgs)

        Dim lc As New RadButton()
        lc.Text = "Next step"
        AddHandler lc.Command, AddressOf RadButton2_Click

        e.RadWizardStep.Controls.Add(lc)

    End Sub

    Protected Sub RadButton2_Click(sender As Object, e As EventArgs)
        Dim [step] As RadWizardStep = DirectCast(DirectCast(sender, RadButton).Parent, RadWizardStep)
        RadWizard1.ActiveStepIndex = RadWizard1.WizardSteps([step].Index).Index + 1
    End Sub

End Class

 

I really hope you can find something.

This is an excerpt from an important project.

 

Thanks, Marc


Viewing all articles
Browse latest Browse all 99250


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>