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

Client side validation causes postback

1 Answer 115 Views
Validation
This is a migrated thread and some comments may be shown as answers.
Gaetano
Top achievements
Rank 1
Gaetano asked on 21 Jan 2013, 03:20 PM
Hi,
I'm trying to do a login page starting from you demo sample.
The client side validation is not working, it runs only server side causing a tedious postback.
I simply copied your code demo.
Am I missing something?

This is my code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="Namespace.Login" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Login</title>
    <link href="Content/Styles/login.css" rel="stylesheet" />
</head>
<body>
    <form id="formLogin" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <div id="rfd-demo-zone">
            <div class="vlaidationSummary">
                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" DecorationZoneID="rfd-demo-zone" />
                    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
 
                    <div class="groupWrapper">
                        <asp:Login ID="Login1" runat="server" Width="100%" EnableViewState="false" OnLoggingIn="Login1_LoggingIn">
                            <LayoutTemplate>
                                <table cellpadding="1" cellspacing="0" width="100%">
                                    <tr>
                                        <td>
                                            <table cellpadding="0" width="100%">
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                                            ErrorMessage="Required" ToolTip="Required" ValidationGroup="Login1"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
 
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="Password" runat="server" TextMode="Password" Text="caffe"></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                                                            ErrorMessage="Required" ToolTip="Required" ValidationGroup="Login1"></asp:RequiredFieldValidator>
                                                    </td>
                                                </tr>
 
                                                <tr>
                                                    <td
                                                    </td>
                                                    <td>
                                                        <asp:CheckBox ID="RememberMe" runat="server" Text="Remember"></asp:CheckBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="center" colspan="2" style="color: Red;">
                                                        <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="text-align: right;">
                                                        <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="Login1"></asp:Button>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </LayoutTemplate>
                        </asp:Login>
                        <asp:Label ID="lblRisultato" Text="" Font-Size="Large" ForeColor="Green" runat="server"></asp:Label>
                        <div style="margin-top: 5px;">
                            <asp:LoginName ID="LoginName1" runat="server" Width="300px" EnableViewState="false"></asp:LoginName>
                        </div>
                        <div style="margin-top: 5px;">
                            <asp:LoginStatus ID="LoginStatus1" runat="server" Width="300px" EnableViewState="false"></asp:LoginStatus>
                        </div>
                        <div style="margin-top: 5px;">
                            <asp:LoginView ID="LoginView1" runat="server" EnableViewState="false">
                                <AnonymousTemplate>
                                    <div style="height: 100px">
                                        This is displayed if the user is NOT logged in!
                                    </div>
                                </AnonymousTemplate>
                                <LoggedInTemplate>
                                    <div style="color: #fff; background-color: #015914; -moz-border-radius: 4px; padding: 4px;">
                                        This is displayed if the user is LOGGED in!
                                    </div>
                                </LoggedInTemplate>
                            </asp:LoginView>
                        </div>
                    </div>
 
                </telerik:RadAjaxPanel>
            </div>
        </div>
    </form>
 
</body>
</html>
The code behind is empty.

Any suggestion will be grateful!
Thank you so much ;)

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 23 Jan 2013, 07:54 AM
Hi Fabio,

I have tried to reproduce your issue, but with no success. The validation is executed properly on the client-side. I have created a short video here. Server-side validation will be triggered only if you have set EnableClientScript property of the validation control to false which is not so in the page you have sent us.

I can suggest that you can look for the presence of any JavaScript errors on your page (they could break the script controls of your page) and fix them. If this is not the case, could you try to reproduce the unexpected behaviour with the VS sample I have attached and then send it back to us, so we can inspect it locally? Could you also confirm the browser and its version under which you are having the issue?

Kind regards,
Danail Vasilev
the Telerik team
Explore the entire set of ASP.NET AJAX controls we offer here and browse the myriad online demos to learn more about the components and the features they incorporate.
Tags
Validation
Asked by
Gaetano
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or