Masked Edit Control

M

metridevkk

Hi,
I need to use a Masked Edit Control in my ASPX page. In VS.Net, I added the
reference to MSMask.dll for my application & also added the MaskEdBox to the
Toolbox.

After adding the control to the web form, when I select the control & see
its properties, I do not see the "Text" property. I also try to set the
"Text" property in a javascript function, but cannot access it.

Here is the code:
=================================================
<HTML>
<HEAD>
<title>WebForm1</title>
<script language="JavaScript">
function LoadControls()
{
alert(document.forms[0].mskOffice);
document.forms[0].mskOffice.Text = "111-111-1111";
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" onLoad="LoadControls();">
<form NAME="form1" id="Form1" method="post" runat="server">
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 252px; POSITION:
absolute; TOP: 83px" runat="server" Width="83px">Enter Phone:</asp:label>
<OBJECT id="mskOffice" style="Z-INDEX: 104; LEFT: 340px; WIDTH: 153px;
POSITION: absolute; TOP: 82px; HEIGHT: 26px" codeBase="msmask32.ocx"
classid="clsid:C932BA85-4374-101B-A56C-00AA003668DC" name="mskOffice"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="4048">
<PARAM NAME="_ExtentY" VALUE="688">
<PARAM NAME="_Version" VALUE="393216">
<PARAM NAME="BorderStyle" VALUE="1">
<PARAM NAME="ClipMode" VALUE="0">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="Appearance" VALUE="1">
<PARAM NAME="BackColor" VALUE="-2147483643">
<PARAM NAME="ForeColor" VALUE="-2147483640">
<PARAM NAME="PromptInclude" VALUE="-1">
<PARAM NAME="AllowPrompt" VALUE="0">
<PARAM NAME="AutoTab" VALUE="0">
<PARAM NAME="HideSelection" VALUE="-1">
<PARAM NAME="Enabled" VALUE="-1">
<PARAM NAME="MaxLength" VALUE="64">
<PARAM NAME="OLEDragMode" VALUE="0">
<PARAM NAME="OLEDropMode" VALUE="0">
<PARAM NAME="PromptChar" VALUE="_">
<PARAM NAME="Mask" VALUE="###-###-####">
</OBJECT>
</form>
</body>
</HTML>

=========================================

alerting "document.forms[0].mskOffice" returns [Object], however the Text
property is not set.

I am a newbie in ASP.NET and ActiveX Controls, so any help will be greatly
appreciated!!!!

Thanks.
 
M

metridevkk

Bcoz I want the "-" character to appear in the phonenumber. When the user
keys in phone number, he need not type the "-" in between, the appears
automatically.

Leon Friesema said:
Hi,
I need to use a Masked Edit Control in my ASPX page. In VS.Net, I added the
reference to MSMask.dll for my application & also added the MaskEdBox to the
Toolbox.

After adding the control to the web form, when I select the control & see
its properties, I do not see the "Text" property. I also try to set the
"Text" property in a javascript function, but cannot access it.

Here is the code:
=================================================
<HTML>
<HEAD>
<title>WebForm1</title>
<script language="JavaScript">
function LoadControls()
{
alert(document.forms[0].mskOffice);
document.forms[0].mskOffice.Text = "111-111-1111";
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout" onLoad="LoadControls();">
<form NAME="form1" id="Form1" method="post" runat="server">
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 252px; POSITION:
absolute; TOP: 83px" runat="server" Width="83px">Enter Phone:</asp:label>
<OBJECT id="mskOffice" style="Z-INDEX: 104; LEFT: 340px; WIDTH: 153px;
POSITION: absolute; TOP: 82px; HEIGHT: 26px" codeBase="msmask32.ocx"
classid="clsid:C932BA85-4374-101B-A56C-00AA003668DC" name="mskOffice"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="4048">
<PARAM NAME="_ExtentY" VALUE="688">
<PARAM NAME="_Version" VALUE="393216">
<PARAM NAME="BorderStyle" VALUE="1">
<PARAM NAME="ClipMode" VALUE="0">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="Appearance" VALUE="1">
<PARAM NAME="BackColor" VALUE="-2147483643">
<PARAM NAME="ForeColor" VALUE="-2147483640">
<PARAM NAME="PromptInclude" VALUE="-1">
<PARAM NAME="AllowPrompt" VALUE="0">
<PARAM NAME="AutoTab" VALUE="0">
<PARAM NAME="HideSelection" VALUE="-1">
<PARAM NAME="Enabled" VALUE="-1">
<PARAM NAME="MaxLength" VALUE="64">
<PARAM NAME="OLEDragMode" VALUE="0">
<PARAM NAME="OLEDropMode" VALUE="0">
<PARAM NAME="PromptChar" VALUE="_">
<PARAM NAME="Mask" VALUE="###-###-####">
</OBJECT>
</form>
</body>
</HTML>

=========================================

alerting "document.forms[0].mskOffice" returns [Object], however the Text
property is not set.

I am a newbie in ASP.NET and ActiveX Controls, so any help will be greatly
appreciated!!!!

Thanks.

Just a suggestion, but why don't you use a Validator?

Leon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top