RadInputManager Validation Code Behind

2 posts, 1 answers
  1. juststarting
    juststarting avatar
    18 posts
    Member since:
    Jul 2012

    Posted 21 Apr 2011 Link to this post

    Hi,

    I have a VB.net web application with a RadInputManager validation on 2 fields (email address & password). Both these fields must be completed.

    <asp:TextBox ID="txtEMail" MaxLength="100" runat="server" Width="250px" />
    <asp:TextBox ID="txtPassword" MaxLength="50" runat="server" Width="250px" TextMode="Password" />
     
    <asp:Button ID="cmdLogin" runat="server" Text="Login" />
      
        <telerik:RadInputManager ID="RadScreenValidator" runat="server">
            <telerik:TextBoxSetting BehaviorID="IsRequired" Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="txtPassword" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:RegExpTextBoxSetting BehaviorID="ValidateEMail" Validation-IsRequired="true" ValidationExpression="^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$">
                <TargetControls>
                    <telerik:TargetInput ControlID="txtEMail" />
                </TargetControls>
            </telerik:RegExpTextBoxSetting>
        </telerik:RadInputManager>

    When the user click on the login button, I check if the email address supplied is in fact of a valid domain using DNS lookup.

    How do I return to the RadInputManage that the validation failed as I dont use any Error messages but rather the yellow warning sign error indicator on the textbox itself.

    Keep in mind that if the email is correctly confirmed in the database & the password is wrong, I just want to warn the user regarding the password not the email address also.

    Thanx
  2. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Apr 2011 Link to this post

    Hello,

    One possibility for this scenario is to pass StartUp Script from the server and on the client just change the css class of the mentioned input to the invalid one.
    Another option could be to use RadInput controls for which you could call invalid in the specific statement. For example:
    radinput1._invalidate();
    radinput1.updateCssClass();


    Best wishes,
    Maria Ilieva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top