Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inputmask for mmTextbox
Message
From
28/07/2010 17:15:37
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01473906
Message ID:
01474357
Views:
32
>Hi Frank,
>
>1. I think with mm controls you have to use CssClass="number".
>2. In order to ensure your script is loading properly, fire up your page in Firefox or IE and use the developer tools (Firebug add-on in FireFox, F12 in IE8+) and click on the script tab. It'll tell you if it found it.
>
I tried CssClass.

I get the Script tab is disabled, so I guess that means it is not finding it. This should work when running this with VS2008's temporary internet server (or whatever it's called) that starts up when I run the project from within VS, right? Or do I need to publish it to my full IIS?

>I didn't get to see much of Trindad except POS and the airport. I lived on St. Croix for a couple of years and was used to the island life, so Trinidad looked pretty similar.
>

:) I think it's a bit busier than St Croix, but I've never been there so can't say for certain.


>Eric
>
>
>>While stuck on another problem I thought I'd look at this to get it working. Unfortunately there must be something I am missing.
>>
>>In my Master file I put this:
>>
>>
<script type="text/javascript" src="/jquery.js"></script>
>><script type="text/javascript" src="/jquery.maskedinput.js"></script>
>><script type="text/javascript">
>>    $("document").ready()
>>    {
>>        $(".number").mask("999,999,999.99");  // Masks all element with the class='number'
>>    }
>>     </script>
>>
>>Then in my aspx page I defined a textbox like this:
>>
>>
<mm:mmTextBox ID="txtMinSumAssured" runat="server" BindingSource="Plan" BindingSourceMember="MinSumAssured"
>>   Width="100px" class="number"></mm:mmTextBox>
>>
>>But I am not getting the masking to work.
>>
>>Any ideas? (apart from "give up web development and become a bartender" <g>)
>>
>>
>>>Hi Frank,
>>>
>>>I put my references to jQuery in the master page, so it only has to be in one place instead of every ASPX page (though this may theoretically slow down each page load, I certainly don't notice it).
>>>
>>>
>>>    <script type='text/javascript' src='./js/jquery.js'/>
>>>    <script type='text/javascript' src='./js/jquery.cookie.js'/>
>>>    <script type="text/javascript" src="./js/date.js"/>
>>>    <script type='text/javascript' src='./js/json2.js'/>
>>>    <script type='text/javascript' src='./js/ui/ui.core.js'/>
>>>    <script type='text/javascript' src='./js/ui/ui.datepicker.js' />
>>>
>>>
>>>If you've specified a class you can use jQuery's selector functionality to apply the mask to all the elements on the page that use that class (or start with/end with a certain string, which is what I do for date fields so they automatically get a nice datepicker functionality). eg (still in the HEAD of the master page)
>>>
>>>     <script type="text/javascript">
>>>        $("document").ready()
>>>        {
>>>            $(".phone").mask("(999) 999-9999");  // Masks all element with the class='phone'
>>>        }
>>>     </script>
>>>
>>>
>>>Alternatively, and this works best if you put it on the specific ASPX page that has the control, you can specify by id
>>>
>>>     <script type="text/javascript">
>>>        $("document").ready()
>>>        {
>>>            $("#HomePhone").mask("(999) 999-9999");  // Masks the element with the id='HomePhone'
>>>        }
>>>    </script>
>>>
>>>
>>>Hope this helps,
>>>
>>>Eric
>>>
>>>
>>>>>Hi Frank,
>>>>>
>>>>>I use jQuery for this.
>>>>>
>>>>>See this page (http://nittrwave.typepad.com/blog/2010/04/jquery-masked-input-plugin.html) for examples. It's super easy.
>>>>>
>>>>>Eric
>>>>
>>>>Eric,
>>>>
>>>>it's not super easy for my tired brain. :(
>>>>
>>>>I have downloaded jsquery.js and put it in the same folder as my aspx pages. Now, where do I put the code:
>>>>
>>>>
<script type="text/javascript" src="jquery.js"></script>
>>>><script type="text/javascript" src="jquery.maskedinput.js"></script>
>>>>
>>>>Does this go in the codebehind file (aspx.cs) or the aspx page?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform