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

Change Active Tab and Step Title

4 Answers 516 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Geo
Top achievements
Rank 1
Geo asked on 12 Dec 2019, 10:01 PM

Hello, I am running into two issues with the RadWizard and related controls.  Here is the scenario we have for our page setup:

 

The first "step" of the wizard contains a RadSearchBox and a RadGrid.  The user locates a client from the SearchBox and their information is loaded into the grid.  The user can then click on an Edit button on the grid row for the record they want to edit.

 

At this point we then load all of the data for that record into the next wizard step.  What we want to do at this point is automatically switch to the next step from the server and then update the step's title from "Add New Record" to "Edit Record".

I have been searching for a way to do this about six months.  We are using a fairly old build of Telerik, I believe circa Q1 or Q2 2013.  I have tried the following but they have not worked:

 

Changing the active step via the RadWizard1.ActiveStepIndex property, setting RadWizard1.Steps(0).Active to false and (1) to true

For changing the Title I have tried RadWizard1.Steps(1).Title and tried setting the title directly using RadWizardStep2.Title

 

None of those have worked either within the Edit button OnClick function nor within the PageLoad or PageLoadCompleted functions for the page (I had thought maybe the default properties for the wizard ands steps were overwriting the changes on postback).

 

I have not tried using a Javascript function yet but we would like to do this server-side if possible.

 

Thanks.

4 Answers, 1 is accepted

Sort by
0
Geo
Top achievements
Rank 1
answered on 12 Dec 2019, 10:04 PM
There should be an edit feature for posts.  We are using VB.Net for the backend.
0
Geo
Top achievements
Rank 1
answered on 12 Dec 2019, 10:09 PM
Found the version number for our Telerik.  It is from 2015: 2015.1.225.40
0
Peter Milchev
Telerik team
answered on 17 Dec 2019, 02:03 PM

Hello Geo,

Here is a sample code showing how this is achieved by accessing the step from the WizardStep collection of the wizard and works properly. 

<telerik:RadWizard runat="server" ID="RadWizard1">
    <WizardSteps>
        <telerik:RadWizardStep ID="WizardStep1" StepType="Start">
            <telerik:RadButton runat="server" ID="RadButton1" Text="Change active step and rename step Title" AutoPostBack="true" OnClick="RadButton1_Click" />
        </telerik:RadWizardStep>
        <telerik:RadWizardStep ID="WizardStep2">
            Step 2
        </telerik:RadWizardStep>
        <telerik:RadWizardStep ID="WizardStep3">
            Step 3
        </telerik:RadWizardStep>
        <telerik:RadWizardStep ID="WizardStep4" StepType="Finish">
            Finish step
        </telerik:RadWizardStep>
        <telerik:RadWizardStep ID="WizardStep5" StepType="Complete">
            Completed!
        </telerik:RadWizardStep>
    </WizardSteps>
</telerik:RadWizard>

Protected Sub RadButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim wizardstep = RadWizard1.WizardSteps(1)
    wizardstep.Active = True
    wizardstep.Title = "This step has its Title changed"
End Sub

If for some reason you have the Grid and SearchBox inside an AjaxPanel/UpdatePanel which is not wrapping the whole wizard, then it is expected to not be able to change the active step and title, because the updated HTML is only the one that is inside the AjaxPanel/UpdatePanel.

Regards,
Peter Milchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Geo
Top achievements
Rank 1
answered on 17 Dec 2019, 05:59 PM

Hello Peter,

I managed to solve this myself by using the Javascript methods client-side and calling the function from the backend.

 

I will post them below in case someone else comes across this use case issue:

JS:

 

function StartEdit() {
    var rdWiz = $find("<%=AuthWizard.ClientID%>");
    if (rdWiz) {
    rdWiz.set_activeIndex(1);
 
    var rdwStep = rdWiz.get_wizardSteps().getWizardStep(1)
 
    if (rdwStep){
       rdwStep.set_title("Edit Auth");
    }
    }
}
 
function EndEdit() {
    var rdWiz = $find("<%=AuthWizard.ClientID%>");
    if (rdWiz) {
    rdWiz.set_activeIndex(0);
 
    var rdwStep = rdWiz.get_wizardSteps().getWizardStep(1)
 
    if (rdwStep){
       rdwStep.set_title("Add New Auth");
    }
    }
}

 

 

Serverside Call to JS:

 pgOps.CallJavascript(Page, "StartEdit()")

 

Utility Function:

Public Sub CallJavascript(targPage As Page, jsFunc As String)
           Dim script1 As String = jsFunc
           RadScriptManager.RegisterStartupScript(targPage, targPage.[GetType](), "Script", script1, True)
End Sub
Tags
Wizard
Asked by
Geo
Top achievements
Rank 1
Answers by
Geo
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or