This is a migrated thread and some comments may be shown as answers.

Create steps depending on user input in first step

1 Answer 165 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Al asked on 06 Dec 2015, 06:02 AM

Hi! I am trying to create HelpDesk functionality using RadWizard to create new incident.

On first step user selects incident category from RadComboBox (hardware problems, software etc)

Then i dynamically create 2 new steps with a different markup depending on combobox selected value.

Everything works fine until user goes back to first step and selects new RadComboBox value.

Functionality allows to do such thing. And i have to delete next steps and create new ones with other markup.

I found simple solution to disable RadComboBox, but it seems to be uncorrect solution. Can you help me?

Here is my code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<head runat="server">
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" />
            <script type="text/javascript">
            <telerik:RadWizard runat="server" ID="RadWizard1" Height="360px"
                 OnNextButtonClick="RadWizard1_NextButtonClick" OnWizardStepCreated="RadWizard1_WizardStepCreated" DisplayCancelButton="True">
                    <telerik:RadWizardStep ID="RadWizardStep1" runat="server" Title="Book Group Vacation" StepType="Start" DisplayCancelButton="True" >
                        <telerik:RadComboBox ID="RadComboBox1" Runat="server" AutoPostBack="False">
                                <telerik:RadComboBoxItem runat="server" Text="1" Value="1" />
                                <telerik:RadComboBoxItem runat="server" Text="2" Value="2" />
                                <telerik:RadComboBoxItem runat="server" Text="3" Value="3" />
                        <label>ComboBox Value Is </label><span id="CB" runat="server"></span>
And code-behind

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
public partial class Default : System.Web.UI.Page
    private static bool _stepCreated = false;
    protected void Page_Load(object sender, EventArgs e)
        if (IsPostBack && !_stepCreated)
            CB.InnerText = RadComboBox1.SelectedValue.ToString();
            RadWizardStep step2 = new RadWizardStep();
            step2.ID = "Second";
            RadWizardStep step3 = new RadWizardStep();
            step3.ID = "Third";
            RadWizardStep completeStep = new RadWizardStep();
            completeStep.ID = "Complete";
            _stepCreated = true;
            RadComboBox1.Enabled = false;
            RadWizard1.ActiveStepIndex = RadWizard1.WizardSteps[1].Index;
    protected void rbRemove_Click(object sender, EventArgs e)
        RadWizardStep step = ((RadWizardStep)((RadButton)sender).Parent);
        RadWizard1.ActiveStepIndex = 0;
    protected void RadWizard1_WizardStepCreated(object sender, Telerik.Web.UI.WizardStepCreatedEventArgs e)
        if (e.RadWizardStep.ID == "Complete")
            e.RadWizardStep.StepType = RadWizardStepType.Complete;
            Label label = new Label();
            label.Text = "Registration succeeded!";
            e.RadWizardStep.CssClass = "passenger";
            string[] labelTitle = new string[] { "First Name:", "Second Name:", "Third Name:" };
            for (int i = 0; i < labelTitle.Length; i++)
                RadTextBox rcbFirstName = new RadTextBox();
                rcbFirstName.LabelWidth = Unit.Pixel(150);
                rcbFirstName.Width = Unit.Pixel(500);
                rcbFirstName.Label = labelTitle[i];
                e.RadWizardStep.Controls.Add(new Literal() { Text = "<br />" });
            RadTextBox rcbVal = new RadTextBox();
            rcbVal.LabelWidth = Unit.Pixel(150);
            rcbVal.Width = Unit.Pixel(500);
            rcbVal.Label = "ComboBoxValue";
            rcbVal.Text = RadComboBox1.SelectedValue.ToString();
            e.RadWizardStep.Controls.Add(new Literal() { Text = "<br />" });
            RadButton rbRemove = new RadButton();
            rbRemove.Text = "Remove Person";
            rbRemove.Click += rbRemove_Click;
    protected void RadWizard1_NextButtonClick(object sender, WizardEventArgs e)
        RadWizard wiz = (RadWizard)sender;

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 09 Dec 2015, 07:51 AM

Disabling RadComboBox seems like a legit solution. You may also check if the steps are already added to the control before adding them so you don't duplicate them.

Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question