AJAX Extender Gives error when placed in Update Panel

Last post 12-31-2008 9:52 AM by Careed. 1 replies.

Sort Posts:

  • AJAX Extender Gives error when placed in Update Panel

    12-31-2008, 9:39 AM
    • Contributor
      7,291 point Contributor
    • sirdneo
    • Member since 12-16-2008, 5:45 AM
    • Karachi, Pakistan
    • Posts 1,147

    Hi, I am using ajax extenders to enhance the functionality of my web site. NOw problem is that i have made a control  which contains following code

     

    1                <asp:TextBox ID="txtDatedDate" runat="server" MaxLength="10" Width="70px" ValidationGroup="TitleSave"></asp:TextBox>
    2                <asp:ImageButton ID="ibtnDatedDate" runat="server" ImageUrl="../Resources/Images/CalendarControlDropDown.GIF"
    3                    ImageAlign="Top" TabIndex="-1" />
    4                <cc1:MaskedEditExtender ID="txtDatedDate_MaskedEditExtender" runat="server" TargetControlID="txtDatedDate"
    5                    Mask="99/99/9999" MessageValidatorTip="true" MaskType="Date" DisplayMoney="None"
    6                    AcceptNegative="None" ErrorTooltipEnabled="True">
    7                </cc1:MaskedEditExtender>
    8                <cc1:CalendarExtender ID="txtDatedDate_CalendarExtender" runat="server" Enabled="True"
    9                    TargetControlID="txtDatedDate" Animated="False" PopupPosition="TopLeft" PopupButtonID="ibtnDatedDate"
    10                   Format="MM/dd/yyyy">
    11               </cc1:CalendarExtender>
    12               <br />
    13               <cc1:MaskedEditValidator ID="txtDatedDate_MaskedEditValidator" runat="server" ControlExtender="txtDatedDate_MaskedEditExtender"
    14                   ControlToValidate="txtDatedDate" SetFocusOnError="true" Display="Dynamic" InvalidValueBlurredMessage="Invalid Date"
    15                   IsValidEmpty="true" ValidationGroup="TitleSave">                     
    16               </cc1:MaskedEditValidator>
    

      This all code is in a seperate ascx page. I am using this code in my main aspx page.  Now if i hide this control inside upadte pannel and set

    txtDatedDate_MaskedEditValidator.enabled = false
    when I try to submit record i get the following error :-
    Microsoft JScript runtime error: 'ctl00_cntplhMain_rpMortgages_ctl01_ucMortgage_ucSuppleme...' is undefined
     this error comes on line 
     headElements[0].appendChild(scriptElement);  of Sys$_ScriptLoader$_loadScriptsInternal() function.
     
    i view the scriptElement and i found following script in its outerHTML:
     

    <SCRIPT type=text/javascript>
    MaskedEditSetCssClass(ctl00_cntplhMain_rpMortgages_ctl01_ucMortgage_ucSupplementalRecording_ucRecordingInformation_txtRecordedDate_MaskedEditValidator,'MaskedEditError');
    </SCRIPT> 
     
     How can I fix this issue plz help me its very urgent.
    BTW thanks In advance 
     
     
    Thanks,
    Zeeshan Umar

    ~Please Mark As Answer, if one or multiple posts, which helped you in your problem. So that it might be useful for others~

    My Blog
    Filed under:
  • Re: AJAX Extender Gives error when placed in Update Panel

    12-31-2008, 9:52 AM
    Answer
    • Star
      8,210 point Star
    • Careed
    • Member since 06-24-2002, 3:37 AM
    • Lubbock, TX
    • Posts 1,611

    I believe that you are confusing the Javascript.  Regardless, if the user control is not visible, then there is no reason to set the Enabled property because IsValidEmpty is already set to true.  In other words, since the TextBox in question will remain empty because it's hidden, no validation will occur anyway.  So, do not set the Enabled property and see what happens.

    Christopher Reed
    "The oxen are slow, but the earth is patient."
Page 1 of 1 (2 items)