本文介绍了文本框更改事件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2个文本框..我在第一个文本框中输入值,当我尝试在textbox2中插入值时,时间信息应小于第一个文本框..mns,我想对此文本框进行验证. .但是显示消息....... bt我想以弹出格式显示味精.....为此给我javacript函数..
i have 2 textboxes..i enter value in first textbox,when i try to insert value in textbox2 that time message should come value should less than first textbox....mns i want to do validation of this textboxes...but showing message.......bt i want to show msg in popup format.....give me javacript function for this.......
推荐答案尝试以下操作,完美运行.. Try following, perfectly working.. <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br /> <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox><br /> <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox4" ControlToValidate="TextBox5" ErrorMessage="value should less than first textbox" Operator="LessThanEqual" Type="Integer"></asp:CompareValidator>
谢谢
Thanks
使用ASP.Net验证控件完全满足您的要求: www.w3schools/aspnet/aspnet_refvalidationcontrols.asp [ ^ ] msdn.microsoft/en-us/library/debza5t0 (v = vs.100).aspx [ ^ ] msdn.microsoft/en-us/library/aa479013.aspx [ ^ ] 谢谢, Ambesha Use the ASP.Net Validation controls o full fill your requirement: www.w3schools/aspnet/aspnet_refvalidationcontrols.asp[^] msdn.microsoft/en-us/library/debza5t0(v=vs.100).aspx[^] msdn.microsoft/en-us/library/aa479013.aspx[^] Thanks, Ambesha
"CompareValidator"将解决您的问题. 1)添加``CompareValidator'' 2)设置以下属性 2.1)ControlToCompare-> textbox1 2.2)ControlToValidate-> textbox2 2.3)ErrorMessage->您的留言在这里 2.4)运算符->小于 2.5)SetFocusonError-> true 2.6)类型->字符串/整数/日期 注意:这仅适用于"LostFocus",而不能在插入文本框时使用(如果您需要使用javascript). The ''CompareValidator'' will solve your issue. 1) add the ''CompareValidator'' 2) Set the following properties 2.1) ControlToCompare->textbox1 2.2) ControlToValidate-> textbox2 2.3) ErrorMessage-> Your Message goes here 2.4) Operator-> Less than 2.5) SetFocusonError->true 2.6) type-> String/Integet/Date Note: this is will work only on ''LostFocus'' not while inserting into the textbox(if you want you need to use the javascript).
更多推荐
文本框更改事件的问题
发布评论