Server side validation doesn't work

7 posts, 0 answers
  1. GD
    GD avatar
    25 posts
    Member since:
    Nov 2008

    Posted 25 Jul 2012 Link to this post

    Qui

    <telerik:RadToolBar ID="radToolBar"
                        BorderWidth="0"
                        BorderStyle="None"
                        AutoPostBack="true"
                        OnClientButtonClicking="SaveToolBar_radToolBar_OnClientButtonClicking"
                        CausesValidation="true"
                        runat="server">
        <Items>
            <telerik:RadToolBarButton Text="Salva"
                                      ImageUrl="~/App_Themes/SETheme/SESkin/Grid/Update.gif"
                                      CommandName="Insert"
                                      Value="Insert"/>
            <telerik:RadToolBarButton Text="Salva"
                                      ImageUrl="~/App_Themes/SETheme/SESkin/Grid/Update.gif"
                                      CommandName="Update" 
                                      Value="Update"/>                               
            <telerik:RadToolBarButton Text="Annulla"
                                      ImageUrl="~/App_Themes/SETheme/SESkin/Grid/Cancel.gif"
                                      CommandName="Cancel"
                                      Value="Cancel" />
        </Items>
    </telerik:RadToolBar>


    Client side validation works correctly.
    Instead Server side validation doesn't work.

    _ServerValidate is executed but if  "args.IsValid = false" the software doesn't stop and continues


    (Version: 2009.3.1103.35)
  2. GD
    GD avatar
    25 posts
    Member since:
    Nov 2008

    Posted 25 Jul 2012 Link to this post

    I test it with 2012.1.411.35 Version: same error!
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 30 Jul 2012 Link to this post

    Hello Claudio,

    How exactly do you implement this? I tested with a simple required field validator, but everything worked as expected.
    <telerik:RadToolBar ID="radToolBar" BorderWidth="0" BorderStyle="None" AutoPostBack="true"
           OnClientButtonClicking="SaveToolBar_radToolBar_OnClientButtonClicking" CausesValidation="true"
           runat="server">
           <Items>
               <telerik:RadToolBarButton Text="Salva" ImageUrl="~/App_Themes/SETheme/SESkin/Grid/Update.gif"
                   CommandName="Insert" Value="Insert" />
               <telerik:RadToolBarButton Text="Salva" ImageUrl="~/App_Themes/SETheme/SESkin/Grid/Update.gif"
                   CommandName="Update" Value="Update" />
               <telerik:RadToolBarButton Text="Annulla" ImageUrl="~/App_Themes/SETheme/SESkin/Grid/Cancel.gif"
                   CommandName="Cancel" Value="Cancel" />
           </Items>
       </telerik:RadToolBar>
       <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
           ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>



    Kind regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. GD
    GD avatar
    25 posts
    Member since:
    Nov 2008

    Posted 30 Jul 2012 Link to this post

    Required filed validator works correct.... not server side validator:


    <asp:CustomValidator id="cvDescrizione" 
                         OnServerValidate="cvDescrizione_ServerValidate"
                         ErrorMessage="Descrizione già presente"
                         runat="server"
                         Display="Dynamic" />


    if "args.IsValid = false" the software doesn't stop and continues.

    For examplae:

    public void cvDescrizione_ServerValidate(object source, ServerValidateEventArgs args)
    {
           args.IsValid = false;
    }



    It should always stop but in fact continues





  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 02 Aug 2012 Link to this post

    Hi Claudio,

    Can you replace RadToolBar with a regular ASP Button and check if you continue to have this problem. Probably there is something specific for your implementation that is causing this issue.

    Regards,
    Peter
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  7. GD
    GD avatar
    25 posts
    Member since:
    Nov 2008

    Posted 07 Sep 2012 Link to this post

    Hi,
    if I use asp button instead of radtoolbar everything works correctly. But I would use telerik radToolbar. I haven't found any examples in telerik demos with radToolbar and server-side CustomValidator.

    Can help me, please?
  8. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 12 Sep 2012 Link to this post

    Hi Claudio,

    I tested the described scenario with the following code and the validation works as expected from my side. Below you can find the code that I used for testing purpose. Please give it a try and let me know how it goes from your side and if I am missing something in your scenario:
    <asp:Label runat="server" ID="Label1" Text="label1"></asp:Label>
           <asp:TextBox runat="server" ID="txtCustom" />
           <asp:Button runat="server" ID="button1" Text="button1" />
           <telerik:RadToolBar runat="server" ID="botton" AutoPostBack="true">
               <Items>
                   <telerik:RadToolBarButton Text="ToolBarButton1" PostBack="true">
                   </telerik:RadToolBarButton>
               </Items>
           </telerik:RadToolBar>
           <asp:CustomValidator runat="server" ID="cusCustom" ControlToValidate="txtCustom"
               OnServerValidate="cusCustom_ServerValidate" ErrorMessage="The text must be exactly 8 characters long!" />
           <br />

    code behind:
    protected void cusCustom_ServerValidate(object sender, ServerValidateEventArgs e)
       {
           if (e.Value.Length == 8)
           {
               e.IsValid = true;
               Label1.Text = " Page is valid";
           }
     
           else
           {
               e.IsValid = false;
               Label1.Text = " Page is NOT valid";
           }
       }

    All the best,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017