DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 8 Apr 2007 19:25:22 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol        back       

Thread Index
  1    Kat
          2    Teemu Keiski


Gridview & Validation Controls   
How do I get the RegularExpressionValidator to work with a gridview during 
an update?  The error message displays briefly -- very briefly, you don't 
even see it unless you are stepping through the code, but the update 
continues as if nothing happened.  If I have to use the RowUpdating event, 
then what's the purpose of the validator?  It appears the 
requiredfieldvalidator works, but not the regularexpressionvalidator.  This 
is my gridview template:

<asp:TemplateField HeaderText="Preferred">

<EditItemTemplate>

<asp:TextBox ID="txtPreferredPhone" runat="server" Text='<%# 
Bind("PhoneNumber") %>' ></asp:TextBox>

<asp:RegularExpressionValidator ControlToValidate="txtPreferredPhone" 
id="valPhoneNumbers" runat="server" ErrorMessage="Please use phone number 
format (111-111-1111)" ToolTip="111-111-1111" 
ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" 
ValidationGroup="PhoneNumberValidator" Display="Dynamic">Incorrect 
format!</asp:RegularExpressionValidator>

</EditItemTemplate>

<ItemTemplate>

<asp:Label ID="Label1" runat="server" Text='<%# Bind("[Preferred #]") 
%>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>
Date:Sun, 8 Apr 2007 19:25:22 -0700   Author:  

Re: Gridview & Validation Controls   
Hi,

do you also do Page.IsValid check in code (yes it needs to be done in order 
to ensure nothing passes server-side validation)?

Does the regexvalidator catch the error at client-side at all? (Do you have 
ValidationSummay on the Page and does it show anything)?


-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net


"Kat"  wrote in message 
news:egKi0XkeHHA.4772@TK2MSFTNGP05.phx.gbl...

> How do I get the RegularExpressionValidator to work with a gridview during 
> an update?  The error message displays briefly -- very briefly, you don't 
> even see it unless you are stepping through the code, but the update 
> continues as if nothing happened.  If I have to use the RowUpdating event, 
> then what's the purpose of the validator?  It appears the 
> requiredfieldvalidator works, but not the regularexpressionvalidator. 
> This is my gridview template:
>
> <asp:TemplateField HeaderText="Preferred">
>
> <EditItemTemplate>
>
> <asp:TextBox ID="txtPreferredPhone" runat="server" Text='<%# 
> Bind("PhoneNumber") %>' ></asp:TextBox>
>
> <asp:RegularExpressionValidator ControlToValidate="txtPreferredPhone" 
> id="valPhoneNumbers" runat="server" ErrorMessage="Please use phone number 
> format (111-111-1111)" ToolTip="111-111-1111" 
> ValidationExpression="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}" 
> ValidationGroup="PhoneNumberValidator" Display="Dynamic">Incorrect 
> format!</asp:RegularExpressionValidator>
>
> </EditItemTemplate>
>
> <ItemTemplate>
>
> <asp:Label ID="Label1" runat="server" Text='<%# Bind("[Preferred #]") 
> %>'></asp:Label>
>
> </ItemTemplate>
>
> </asp:TemplateField>
>
>
>
> 
Date:Mon, 9 Apr 2007 16:17:50 +0300   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us