如何使用ASP .NET填充掩码文本框 [英] How to fill the mask text box using ASP .NET
本文介绍了如何使用ASP .NET填充掩码文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用asp .net
填充蒙版文本框我的蒙版文本框就像这样
< uc1:MaskTextBox ID = msk_testrunat =serverInputMask =NNNN / NNNN / NNNN>< / uc1:MaskTextBox>
我没有获得房产msk_test.Text
我尝试过:
msk_test.CssClassTextBox =5555/5555 / 5555\" ;
msk_test.InputMask =5555/5555/5555;
它显示空白
解决方案
MaskedTextBox
本质上是一个扩展器,它附加到TextBox
控件,以限制可输入的文本类型。如果你指的是AJAXControlToolkit
MaskEditExtender
控件,那么你必须设置TargetControlID
指向要应用掩码的实际TextBox
。例如:
< cc1:MaskedEditExtender ID = < span class =code-string> MaskedEditExtender1 runat = server TargetControlID = TextBox1 ... />
然后您可以使用TextBox1
的.Text
属性来获取实际值被屏蔽的价值。
string theValue = TextBox1.Text;
更多信息,请参阅: ASP.NET C#中的AJAX控件工具包屏蔽编辑教程示例 - Ajax教程,技巧和代码示例 [ ^ ]
How to Fill the Mask Text box using asp .net My Mask Text box is like this <uc1:MaskTextBox ID="msk_test" runat="server" InputMask="NNNN/NNNN/NNNN"></uc1:MaskTextBox> and i am not getting the property msk_test.Text What I have tried: msk_test.CssClassTextBox="5555/5555/5555"; msk_test.InputMask = "5555/5555/5555"; It is showing blank
解决方案
MaskedTextBox
is essentially an extender that attaches to aTextBox
control to restrict the kind of text that can be entered. If you are referring to aAJAXControlToolkit
MaskEditExtender
control, then you have to set theTargetControlID
pointing to the actualTextBox
that you want to apply the mask. For example:
<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TextBox1" .../>
You can then use the.Text
property ofTextBox1
to get the actual value being masked.
string theValue = TextBox1.Text;
More info, see: AJAX Control ToolKit Masked Edit Tutorial Example in ASP.NET C# - Ajax Tutorials, Tricks, and Code Examples[^]
这篇关于如何使用ASP .NET填充掩码文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文