tags:

views:

4

answers:

0

Hi all my goal is to render some message when i type a user name in the user registration page. The message is getting displayed properly at the moment. But after i click the save button without satisfying the validation criteria, the message is not getting displayed when i type some name in user registration text field.

The code is as follows,

<div>
                <asp:UpdatePanel ID="upLunk" runat="server"  UpdateMode="Conditional">
                    <ContentTemplate>
                        <label for="txtLogin">Desired Login ID:<span class="smallText Red">*</span></label>
                        <asp:TextBox ID="txtLogin" runat="server" MaxLength="44"  autocomplete="off" CssClass="text" TabIndex="10" onfocus="clrMsg();" onkeypress="clrMsg();" onblur="CheckLoginAvailabilityajax();"></asp:TextBox>
                        <div class="instruction">
                            <%--<asp:RegularExpressionValidator ValidationGroup="payment" ID="regLogin" CssClass="hide" runat="server" ControlToValidate="txtLogin" ErrorMessage="Login ID should be around 6 - 44 characters" Display="None" ValidationExpression="(?=.*).{6,44}$"></asp:RegularExpressionValidator>--%>
                           <%-- <asp:LinkButton ID="LB_checkuseravailability" OnClick ="LB_checkuseravailability_Click" TabIndex="11" runat="server" CausesValidation="False" CssClass="smallText" OnClientClick="javascript:return chkUserAvailability();" >Click to see if ID is available</asp:LinkButton>--%>
                            <div>
                                <asp:Label ID="lbl_avail" runat="server"></asp:Label>
                            </div>
                             <div id="mydiv" class="green"> </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel> 
            </div>

and the function is as follows,

 function CheckLoginAvailabilityajax()
     {
        var txtusername= document.getElementById('<%=txtLogin.ClientID%>');
        var returnValue=  UserRegister.CheckLoginAvailability(txtusername.value);
        $("#mydiv").text(returnValue.value);
        $("#mydiv:contains('exists')").removeClass("green");
        $("#mydiv:contains('exists')").addClass("Red");
        $("#mydiv:contains('available')").removeClass("Red");
        $("#mydiv:contains('available')").addClass("green");

        $("#mydiv:contains('Enter')").removeClass("green");
        $("#mydiv:contains('Enter')").addClass("Red");

        $("#mydiv:contains('around')").removeClass("green");
        $("#mydiv:contains('around')").addClass("Red");
     }  

I cant get to the bottom of this problem. Any help would be appreciated.

Thanks.

related questions