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

Server side validation doesn't work

6 Answers 97 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
GD
Top achievements
Rank 1
GD asked on 25 Jul 2012, 09:59 AM
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)

6 Answers, 1 is accepted

Sort by
0
GD
Top achievements
Rank 1
answered on 25 Jul 2012, 10:52 AM
I test it with 2012.1.411.35 Version: same error!
0
Peter
Telerik team
answered on 30 Jul 2012, 07:36 AM
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.
0
GD
Top achievements
Rank 1
answered on 30 Jul 2012, 01:59 PM
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





0
Peter
Telerik team
answered on 02 Aug 2012, 08:35 AM
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.
0
GD
Top achievements
Rank 1
answered on 07 Sep 2012, 09:57 AM
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?
0
Kate
Telerik team
answered on 12 Sep 2012, 01:27 PM
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.
Tags
ToolBar
Asked by
GD
Top achievements
Rank 1
Answers by
GD
Top achievements
Rank 1
Peter
Telerik team
Kate
Telerik team
Share this question
or