当我有一个RequiredFieldValidator时,为什么页面是PostBack [英] why page is PostBack when I have a RequiredFieldValidator

查看:70
本文介绍了当我有一个RequiredFieldValidator时,为什么页面是PostBack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有autoPostBack的TextBox设置为true,带有RequiredFieldValidator



I have a TextBox with autoPostBack Set to true with a RequiredFieldValidator

<asp:TextBox ID="txtLaborID" runat="server" AutoPostBack="True"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtLaborID" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>





在ocdeBehind的TextChanged上我有代码。



问题是我有文字的时候在并清空此文本并按Tab键页面正在回发这不应该发生,因为我有RequiredFieldValidator。为何回帖?



And on TextChanged in ocdeBehind I have the code.

The problem is when I have text it in and empty this text and press tab the page is posting back this should not happen since I have RequiredFieldValidator. Why it is posting back?

推荐答案

请参阅以下链接,了解类似问题



http://forums.asp.net/t/1919818.aspx?TextBox+CausesValidation [<一个href =http://forums.asp.net/t/1919818.aspx?TextBox+CausesValidationtarget =_ blanktitle =New Window> ^ ]



http://forums.asp.net/t/1119411.aspx [< a href =http://forums.asp.net/t/1119411.aspxtarget =_ blanktitle =新窗口> ^ ]



希望这有帮助......
Refer the links below which deals with similar issue

http://forums.asp.net/t/1919818.aspx?TextBox+CausesValidation[^]

http://forums.asp.net/t/1119411.aspx[^]

Hope this helps...


引用:

为什么页面是PostBack我有一个RequiredFieldValidator

why page is PostBack when I have a RequiredFieldValidator





由于文本框的Autopostback属性,页面得到回发。

参考这里:

TextBox.AutoPostBack Property [ ^ ]


这篇关于当我有一个RequiredFieldValidator时,为什么页面是PostBack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆