Skip to content

Commit df4ba70

Browse files
github-actions[bot]KB Bot
and
KB Bot
authored
Added new kb article wizard-use-floating-action-button-for-navigation-and-disable-next-button-control (#625)
Co-authored-by: KB Bot <[email protected]>
1 parent 9c43264 commit df4ba70

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
title: Use FloatingActionButton for Navigating RadWizard Steps and Control Next Button Visibility
3+
description: Learn how to navigate to a specific step in RadWizard using FloatingActionButton based on the step's title and how to programmatically control the visibility and enablement of the Next button.
4+
type: how-to
5+
page_title: Use FloatingActionButton for Navigating RadWizard Steps and Control Next Button Visibility
6+
slug: wizard-use-floating-action-button-for-navigation-and-disable-next-button-control
7+
tags: radwizard, floatingactionbutton, navigation, javascript, visibility, enablement
8+
res_type: kb
9+
ticketid: 1669233
10+
---
11+
12+
## Environment
13+
14+
<table>
15+
<tbody>
16+
<tr>
17+
<td>Product</td>
18+
<td>RadWizard for ASP.NET AJAX</td>
19+
</tr>
20+
<tr>
21+
<td>Version</td>
22+
<td>All</td>
23+
</tr>
24+
</tbody>
25+
</table>
26+
27+
## Description
28+
I want to use a FloatingActionButton to navigate to a specific step in a RadWizard based on the step's title. The wizard has a dynamic number of steps, so I cannot rely on the index number. Additionally, I need to hide or disable the "Next" button in the wizard and then show or enable it from the code-behind.
29+
30+
This KB article also answers the following questions:
31+
32+
- How can I navigate between wizard steps using custom controls?
33+
- How do I control the visibility of the RadWizard Next button?
34+
- Is it possible to activate a specific RadWizard step using JavaScript?
35+
36+
## Solution
37+
38+
### Jump to a Specific Wizard Step Using FloatingActionButton
39+
40+
To navigate to a specific RadWizard step using a FloatingActionButton based on the step's title, follow these steps:
41+
42+
1. Add the RadWizard and RadFloatingActionButton to your page.
43+
2. Implement a JavaScript function that iterates through the wizard steps, finds the desired step by title, and sets it as active.
44+
45+
````ASP.NET
46+
<telerik:RadWizard runat="server" ID="RadWizard1">
47+
<WizardSteps>
48+
<telerik:RadWizardStep ID="WizardStep1" StepType="Start" Title="Step1">
49+
Step 1
50+
</telerik:RadWizardStep>
51+
<telerik:RadWizardStep ID="WizardStep2" Title="Step2">
52+
Step 2
53+
</telerik:RadWizardStep>
54+
<telerik:RadWizardStep ID="WizardStep3" Title="Step3">
55+
Step 3
56+
</telerik:RadWizardStep>
57+
<telerik:RadWizardStep ID="WizardStep4" StepType="Finish" Title="Step4">
58+
Finish step
59+
</telerik:RadWizardStep>
60+
</WizardSteps>
61+
</telerik:RadWizard>
62+
63+
<telerik:RadFloatingActionButton runat="server" ID="SurveyAction" Icon="cog" Skin="Bootstrap" PositionMode="Absolute" Align="BottomEnd">
64+
<Items>
65+
<telerik:FloatingActionButtonItem Label="Jump to Page" OnClientClicked="FunctionToJump" Title="Jump to step 2" CssClass="text-bg-success" />
66+
</Items>
67+
</telerik:RadFloatingActionButton>
68+
69+
<telerik:RadButton runat="server" ID="RadButton2" Text="Disable next button" AutoPostBack="false" OnClientClicked="onClientClicked" /> <br />
70+
<telerik:RadButton runat="server" ID="RadButton1" Text="Enable from server" AutoPostBack="true" OnClick="RadButton1_Click" />
71+
````
72+
73+
````JavaScript
74+
function onClientClicked(sender, args) {
75+
let wizard = $find("<%= RadWizard1.ClientID %>");
76+
let nextButton = wizard.get_nextButtonElement();
77+
78+
nextButton.disabled = true;
79+
80+
// If you wannt to hide it:
81+
// nextButton.style.display = "none"
82+
}
83+
84+
function FunctionToJump(sender, args) {
85+
let wizard = $find("<%= RadWizard1.ClientID %>");
86+
let steps = wizard.get_wizardSteps();
87+
88+
steps._data.forEach((step) => {
89+
let title = step.get_title();
90+
91+
if (title === "Step3") {
92+
step.set_active(true);
93+
}
94+
})
95+
}
96+
````
97+
98+
````C#
99+
protected void RadButton1_Click(object sender, EventArgs e)
100+
{
101+
string script = @"
102+
function f() {
103+
let wizard = $find('" + RadWizard1.ClientID + @"');
104+
let nextButton = wizard.get_nextButtonElement();
105+
106+
nextButton.disabled = false;
107+
Sys.Application.remove_load(f);
108+
}
109+
Sys.Application.add_load(f);
110+
";
111+
112+
ScriptManager.RegisterStartupScript(this, this.GetType(), "enableButtonScript", script, true);
113+
}
114+
````
115+
116+
## See Also
117+
118+
- [RadWizard Documentation](https://docs.telerik.com/devtools/aspnet-ajax/controls/wizard/overview)
119+
- [RadFloatingActionButton Documentation](https://docs.telerik.com/devtools/aspnet-ajax/controls/floatingactionbutton/overview)
120+
- [JavaScript API Reference for RadWizard](https://docs.telerik.com/devtools/aspnet-ajax/controls/wizard/client-side-programming/overview)

0 commit comments

Comments
 (0)