Disable navigation via Navigation Bar

7 posts, 0 answers
  1. Stephan Reisinger
    Stephan Reisinger avatar
    24 posts
    Member since:
    Jan 2005

    Posted 31 Oct 2014 Link to this post

    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
  2. Stephan Reisinger
    Stephan Reisinger avatar
    24 posts
    Member since:
    Jan 2005

    Posted 31 Oct 2014 in reply to Stephan Reisinger Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 03 Nov 2014 Link to this post

    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
  5. Guy
    Guy avatar
    10 posts
    Member since:
    Mar 2009

    Posted 16 Nov 2014 in reply to Stephan Reisinger Link to this post

    Why don't you use field validation ?  The samples on the site contains field validation
  6. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 19 Nov 2014 Link to this post

    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
  7. mostafa
    mostafa avatar
    2 posts
    Member since:
    Feb 2015

    Posted 26 Feb 2015 in reply to Plamen Link to this post

    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
  8. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 27 Feb 2015 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017