Results 1 to 2 of 2

Thread: problem with ajax calendar extender not hiding

  1. #1

    Thread Starter
    Hyperactive Member jasonwucinski's Avatar
    Join Date
    Mar 2010
    Location
    Pittsburgh
    Posts
    452

    problem with ajax calendar extender not hiding

    hello everyone,
    i have a calendar extender in my page. it works fine unless i add a maskedEditExtender as well. Then, when the page start or is post back, the calendar starts off as being visible. is there anyway to hide or disable this control when the page starts, until the user clicks the appropriate text box? the code i have is as follows:

    Code:
    <asp:TextBox ID="TextBox2" runat="server" Width="130px" 
                        MaxLength="1" style="text-align:justify" ValidationGroup="MKE" />  
    <div id="error2" style="color:red"></div>
                        <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender2" runat="server"  
                            TargetControlID="TextBox2"  
                            Mask="99/99/9999"                    
                            MaskType="Date"  
                        />  
                        <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator2" runat="server"  
                            ControlExtender="MaskedEditExtender2"  
                            ControlToValidate="TextBox2"                     
                            ValidationGroup="MKE2" />  
                         <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" 
                         TargetControlID="TextBox2" Animated="False"  BehaviorID="calendar2" />
    on the codebehind i have:

    Code:
                Me.TextBox1.Text = Date.Now.AddDays(-7).ToString("MM/dd/yyyy")
                Me.TextBox2.Text = Date.Now.AddDays(0).ToString("MM/dd/yyyy")
    which seems to be the problem. this cause the focus to go to the calendar control and sets the date, which shows the extender. i've tried to set focus to other controls but nothing seems to work. any help would be great

    thanks
    jason
    Last edited by jasonwucinski; May 23rd, 2012 at 09:15 AM.
    if i was able to help, rate my post!

  2. #2

    Thread Starter
    Hyperactive Member jasonwucinski's Avatar
    Join Date
    Mar 2010
    Location
    Pittsburgh
    Posts
    452

    Re: problem with ajax calendar extender not hiding

    well, if anyone else needs this, what i did was created some javascript that hides the calendar and sets the focus to another control. like this:


    javascript Code:
    1. function pageLoad(sendor,e)
    2.         {
    3.         var calendarBehavior=$find("calendar2");
    4.         calendarBehavior.set_selectedDate('<%=DateTime.Now.ToString() %>');
    5.         calendarBehavior.hide()
    6.         var getDDL =document.getElementById('reportView1_ddlMatType')
    7.         getDDL.focus()
    8.         return false
    9.         }
    if i was able to help, rate my post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width