在文本框的编辑值之后,RegularExpressionValidator得到valid = false
问题描述:
大家好,
请提出建议,
在这里,我使用regularExpressionValidator来验证测试框的值,
在添加值然后保存后,文本框值将得到保存,
但是当我更新此值时,我得到了page.isvalid = false.
Hello All,
Please suggest,
Here I have used regularExpressionValidator for validating testbox value,
After Adding value and then Save ,textbox value get save,
but when i update this value ,then i got page.isvalid=false.
<asp:RegularExpressionValidator ID="RegtxtEstimatedCurrentValue" runat="server" ControlToValidate="txtEstimatedCurrentValue"Display="none" ErrorMessage="Please enter valid amount." ValidationExpression="([0-9]*(\.[0-9]+)?)|([0-9]+)"ValidationGroup="valgrpPropertyVal"></asp:RegularExpressionValidator>
<cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender16" runat="server" TargetControlID="RegtxtEstimatedCurrentValue" WarningIconImageUrl="../Images/Error.png" Enabled="True">
</cc1:ValidatorCalloutExtender>
代码隐藏-----
btncave_click()
{
if(this.isvalid == true)
{
保存数据---
}
}
请告诉我解决方案
codebehind-----
btncave_click()
{
if(this.isvalid == true)
{
save data---
}
}
Please tell me the solution
答
新值首先有效吗?
您是否已在btncave_click()
中检查了文本框的内容 方法?检查页面生命周期,在这种情况下通常是罪魁祸首.
页面生命周期 [
Is the new value valid in the first place?
Have you checked the contents of your textbox in the btncave_click()
method? Check the page lifetime cycle, that''s often the culprit in such cases.
Page lifetime cycle[^]
Hope this helps.