locked
Why doesn't ajax control work when page is loaded for the first time ? RRS feed

  • Question

  • User-886220824 posted

    I have used ajax toolkit in web forms with updatepanel in it. I have used MaskEditExtender over a textbox. It doesn't work when the page is loaded for the first time but works if a postback occurs on page of any kind. This is the issue for every AjaxControl in page. Why ?

    <asp:TextBox ID="txtBoxNICNo" runat="server" onkeypress="return isNumberKeyCNIC(this)" ClientIDMode="Static" placeholder="XXXXX-XXXXXXX-X" MaxLength="15" CssClass="form-control"></asp:TextBox>
    <asp:maskededitextender id="MaskedEditExtenderCNIC" runat="server" targetcontrolid="txtBoxNICNo" mask="99999-9999999-9" messagevalidatortip="true"
    onfocuscssclass="MaskedEditFocus" oninvalidcssclass="MaskedEditError"
    masktype="Number" inputdirection="LeftToRight"errortooltipenabled="True">
    </asp:maskededitextender>



    Thursday, January 14, 2016 12:37 PM

Answers

  • User61956409 posted

    Hi StackUnderflow,

    According to your description, I try to reproduce your problem on my side, but I don’t get any problem.

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="txtBoxNICNo" runat="server"></asp:TextBox>
    
            <asp:MaskedEditExtender ID="MaskedEditExtenderCNIC" runat="server" TargetControlID="txtBoxNICNo"
                Mask="99999-9999999-9" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
                OnInvalidCssClass="MaskedEditError" MaskType="Number" InputDirection="LeftToRight"
                ErrorTooltipEnabled="True">
            </asp:MaskedEditExtender>
        </ContentTemplate>
    </asp:UpdatePanel>
    

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 15, 2016 3:02 AM