Problem using MaskedEditExtender

Last post 02-13-2009 10:55 AM by NovaxX. 6 replies.

Sort Posts:

  • Problem using MaskedEditExtender

    01-31-2009, 3:45 AM
    • Member
      2 point Member
    • NovaxX
    • Member since 01-31-2009, 3:25 AM
    • Posts 6

     I have been trying to get the MaskedEditExtender to work as shown on the samples web page but have to no avail.

    The problem I face is that the page, when viewed using Internet Explorer 7 will not remove the underscores as I type and the values I type in beginning with 0 for example 09:30 cannot be registered correctly (as per the behaviour shown in the sample web site).

    Also, an error with the following message is found:

    "Object doesn't support this property or method."

     Below is the piece of code in which I have been trying to get to work.

    <p>
        Trip Start Time:
        <br />
        <asp:TextBox ID="tbTimeStart" runat="server" ValidationGroup="MKE"></asp:TextBox>
        <ajaxToolkit:MaskedEditExtender ID="tbTimeStart_MaskedEditExtender" runat="server"
            Enabled="True" Mask="99:99" MaskType="Time" TargetControlID="tbTimeStart" UserTimeFormat="TwentyFourHour" />
        <ajaxToolkit:MaskedEditValidator ID="tbTimeStart_MaskedEditValidator" runat="server"
            ControlExtender="tbTimeStart_MaskedEditExtender" ControlToValidate="tbTimeStart"
            ValidationGroup="MKE" Display="Dynamic" EmptyValueBlurredText="*" EmptyValueMessage="Please enter a valid 24H. (HH:mm)"
            InvalidValueMessage="Invalid time entered." IsValidEmpty="False" TooltipMessage="Enter a valid 24H time. (HH:mm)" />
    </p>

    I have already tried the page with several browsers and found it to work normally as per the sample web page for Firefox and Chrome. But it will not work on Internet Explorer 7 which is my default browser.

    Using IE7 to browse the sample web site proves to show no problems. It seems to act only on my page. I believe that I may have left out some settings (web.config or imports) and anyone who can suggest me solutions will be most welcome.

  • Re: Problem using MaskedEditExtender

    01-31-2009, 4:34 AM
    • Member
      2 point Member
    • NovaxX
    • Member since 01-31-2009, 3:25 AM
    • Posts 6

    Just a note, My project was created using the standard VS Web Application Template rather than the AJAX one.

    Also, I have tried the code both within and without an UpdatePanel but with the same results.

    For illustration, this is what i get when running the page in IE7.

    For entering a time of 1212h = 1212__:__

    Result = 12:12

    For entering 0930h = 0930__:__

    Result = 93:00 (Error)

  • Re: Problem using MaskedEditExtender

    02-04-2009, 12:50 AM
    Hi NovaxX
     
    I have tried your code on our lab, however, it works fine.
     
    So I speculate it may because of the Localization, and in this scenario, I would like to suggest you try the following code, which works fine on our lab:
      
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnableScriptLocalization="True">
            </ajaxToolkit:ToolkitScriptManager>
            <p>
                Trip Start Time:
                <br />
                <asp:TextBox ID="tbTimeStart" runat="server" ValidationGroup="MKE"></asp:TextBox>
                <ajaxToolkit:MaskedEditExtender ID="tbTimeStart_MaskedEditExtender" runat="server"
                    Enabled="True" Mask="99:99" MaskType="Time" TargetControlID="tbTimeStart" UserTimeFormat="TwentyFourHour"
                    CultureName="en-us" />
                <ajaxToolkit:MaskedEditValidator ID="tbTimeStart_MaskedEditValidator" runat="server"
                    ControlExtender="tbTimeStart_MaskedEditExtender" ControlToValidate="tbTimeStart"
                    ValidationGroup="MKE" Display="Dynamic" EmptyValueBlurredText="*" EmptyValueMessage="Please enter a valid 24H. (HH:mm)"
                    InvalidValueMessage="Invalid time entered." IsValidEmpty="False" TooltipMessage="Enter a valid 24H time. (HH:mm)" />
            </p>
        </div>
        </form>
    </body>
    </html>
    
     

    Thanks.

     

    Lance Zhang
  • Re: Problem using MaskedEditExtender

    02-04-2009, 1:27 AM
    • Member
      2 point Member
    • NovaxX
    • Member since 01-31-2009, 3:25 AM
    • Posts 6

    Can I then assume that the ToolkitScriptManager should be used in preference over the Default ScriptManager provided in the .NET Framework 3.5?

  • Re: Problem using MaskedEditExtender

    02-04-2009, 1:42 AM
    Answer
    Yes, We can replace the default <asp:scriptmanager> control with ToolkitScriptManager control in the AJAX Control Toolkit, it supports the ability to dynamically merge multiple client-side Javascript scripts into a single file that is downloaded to the client at runtime.

    Better yet, only the Javascript needed by the specific controls on the page are included within the combined download, to make it as small as possible. 



     


    As the screen shot shows, It is a big savings in requests - we now get one request for Toolkit scripts instead of 12.

    In this scenario, we also got about a 50% download speed improvement by only having one request.

    for more information:

    ScriptManager vs. ToolkitScriptManager
    http://blog.turlov.com/2008/05/scriptmanager-vs-toolkitscriptmanager.html
     
    ASP.NET AJAX Performance Improvement
    http://lancezhang.wordpress.com/2008/11/15/aspnet-ajax-performance/
     
    Thanks.

     

    Lance Zhang
  • Re: Problem using MaskedEditExtender

    02-04-2009, 2:33 AM
    • Member
      2 point Member
    • NovaxX
    • Member since 01-31-2009, 3:25 AM
    • Posts 6

    Thanks for the reply.

    I have yet to try and see if the ToolkitScriptManager stops the erratic behaviour I experience on my page. But it is good to learn that the ToolkitScriptManager is more performant than the ScriptManager.

  • Re: Problem using MaskedEditExtender

    02-13-2009, 10:55 AM
    Answer
    • Member
      2 point Member
    • NovaxX
    • Member since 01-31-2009, 3:25 AM
    • Posts 6

    After trying out the ToolkitScriptManager, my browser behaviour is more or less consistent on all my available test browsers.

    Although I am not certain of the performance gains, I will say that using the ToolScriptManager is better in handling AJAX behaviour.

Page 1 of 1 (7 items)