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

Disable navigation via Navigation Bar

6 Answers 509 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Stephan Reisinger
Top achievements
Rank 1
Stephan Reisinger asked on 31 Oct 2014, 03:20 PM
Good afternoon !

Is there an easy way to disable the navigation inside the RadWizards Navigation Bar ?

Reason:

I would like to validate the RadWizardSteps during an Ajax PostBack when the NextButtonClick event is fired.
The EventArgs during the ActiveStepChanged event do not provide CurrentStepIndex or other information of the WizardEventArgs

Code:

Dim __Wizard As RadWizard = sender
 
 Try
 
     Select Case e.CurrentStepIndex
 
         Case o_Step_Company.Index
 
             Me._Validate_Companies()
 
         Case o_Step_DateFilter.Index
 
             Me._Validate_Dates()
 
     End Select
 
 Catch vx As ValidationException
 
     vx.CreateNotification()
 
     __Wizard.ActiveStepIndex = e.CurrentStepIndex
 
 Catch ex As System.Exception
 
     ex.SaveToDatabase()
     ex.CreateNotification()
 
 End Try

Thanks,

S. REISINGER

6 Answers, 1 is accepted

Sort by
0
Stephan Reisinger
Top achievements
Rank 1
answered on 31 Oct 2014, 03:27 PM
Forgot to add:

ASP.NET AJAX Controls Version : 2014.3.1024.40 on ASP.Net 4.0 hosted in IIS Express
Visual Studio Ultimate 2013 12.0.30723.00 Update 3
0
Plamen
Telerik team
answered on 03 Nov 2014, 08:46 AM
Hello,

You can use the NavigationBarButtonClick server-side event where the current and next step indexes are available. Here is a sample code that worked correctly at my side:
protected void Unnamed_NavigationBarButtonClick(object sender, WizardEventArgs e)
   {
       if (String.IsNullOrEmpty(TextBox1.Text))
       {
           ((RadWizard)sender).ActiveStepIndex = e.CurrentStepIndex;
       }
   }

Hope this information will be helpful.

Regards,
Plamen
Telerik
0
Guy
Top achievements
Rank 1
answered on 17 Nov 2014, 12:58 AM
Why don't you use field validation ?  The samples on the site contains field validation
0
Plamen
Telerik team
answered on 19 Nov 2014, 08:49 AM
Hello,

Yes this is another way to handle the scenario with server validation as for example in the code below or with client validation as explained in this help topic.:
<telerik:RadWizard ID="RadWizard6" runat="server" OnNextButtonClick="RadWizard6_NextButtonClick">
               <WizardSteps>
                   <telerik:RadWizardStep ID="RadWizardStep1" Title="Personal Info" runat="server" StepType="Step" ValidationGroup="personalInfo">
                       <div class="inputWapper first">
                           <asp:Label ID="Label3" Text="First Name: *" runat="server" AssociatedControlID="FirstNameTextBox" />
                           <telerik:RadTextBox ID="FirstNameTextBox" runat="server" ValidationGroup="personalInfo" Width="320px"></telerik:RadTextBox>
                           <asp:RequiredFieldValidator ID="FirstNameRequiredFieldValidator" runat="server" ControlToValidate="FirstNameTextBox"
                               EnableClientScript="false" ValidationGroup="personalInfo" ErrorMessage="required field" CssClass="validator" ForeColor="Red"></asp:RequiredFieldValidator>
                       </div>
                       <div class="inputWapper">
                           <asp:Label ID="Label4" Text="Last Name: *" runat="server" AssociatedControlID="LastNameTextBox" />
                           <telerik:RadTextBox ID="LastNameTextBox" runat="server" ValidationGroup="personalInfo" Width="320px"></telerik:RadTextBox>
                           <asp:RequiredFieldValidator ID="LastNameRequiredFieldValidator" runat="server" ControlToValidate="LastNameTextBox"
                               EnableClientScript="false" ValidationGroup="personalInfo" ErrorMessage="required field" CssClass="validator" ForeColor="Red"></asp:RequiredFieldValidator>
                       </div>
                   </telerik:RadWizardStep>
                   <telerik:RadWizardStep Title="SecondStep">
                       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                   </telerik:RadWizardStep>
               </WizardSteps>
           </telerik:RadWizard>


Regards,
Plamen
Telerik
0
mostafa
Top achievements
Rank 1
answered on 26 Feb 2015, 12:05 PM
I used demo code for wizard and validation but the client side validation does not work
in fact client validation function does not fire at all
0
Plamen
Telerik team
answered on 27 Feb 2015, 06:36 AM
Hello Mostafa,

I have tested the code provided in the previous post and it worked correctly at my side just after removing the EnableClientScript="false" that is set.

Hope this will help you solve the issue.

Regards,
Plamen
Telerik
Tags
Wizard
Asked by
Stephan Reisinger
Top achievements
Rank 1
Answers by
Stephan Reisinger
Top achievements
Rank 1
Plamen
Telerik team
Guy
Top achievements
Rank 1
mostafa
Top achievements
Rank 1
Share this question
or