473,395 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Gridview validation - almost perfect - but not quite

2
Hi

This is a vb (2008) asp site.

I'm using validators in a gridview control. The columns have been converted to templates and, when editing the data the validation works as expected.

However, when the gridview first goes into Edit mode, even if the existing data fails validation, the validators don't highlight the errors UNTIL the data has been manually edited and the field loses focus. Only then do the validators correctly show the validation errors.

How can I programatically force the validators to check the validation and display their messages when the gridview is first displayed, before the data is edited ?

btw: The validators are warning the user about business rules so it's possible that data from the database may fail validation.

Cheers - G
Jun 17 '10 #1
3 2039
Maybe do this inside Gridview.RowEditing event
Expand|Select|Wrap|Line Numbers
  1. FieldValidator.ControlToValidate = "control"
  2. FieldValidator.Validate()
  3.  
Jun 17 '10 #2
guybuk
2
@benwizzle
Thanks benwizle, I had a quick look at this but don't seem to have access to the validation controls, within the gridview, on the page. I tink could get a readonly refrence from GridView1.Controls collection but can't call the validate method on that.
Am I missing something obvious here :o)
Jun 22 '10 #3
Sorry it took me so long to respond. I have been quite busy. I will recreate this problem ASAP and see what I can work up. Personally, Ive never had this problem because I dont use the validator controls. I just hardcode all my validation.
Jun 25 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Phil Powell | last post by:
Has anyone here ever done a case where you have a select multiple form element and you have to do both server-side and client-side validation? I am honestly not sure how to do it in Javascript (I...
23
by: Ash | last post by:
Hi everyone, This problem has been puzzling me for a fair time now, and has severely frustrated me!! Perhaps I'm just not getting the syntax right, but the problem is rather simple... Take a...
41
by: Gérard Talbot | last post by:
Cross-posted to: comp.infosystems.www.authoring.html and alt.html Followup-to: comp.infosystems.www.authoring.html 1- One day, I stumbled across a website that offers to validate webpages. What...
6
by: DEWright_CA | last post by:
This is a hard one for me, I am fairly new to C#/ASP.net and need some suggestions! I have 3 controls on a page, if control 'ivtshp' has a value it is valid and requires 'ivrng' to have a value....
2
by: baroque Chou | last post by:
I am using validation controls for input validation, but I would like to know whether the validation occurs at client side or server side, dose this cause any round trip. It has a runat=server...
0
by: Mike P | last post by:
Does anybody know of any good tutorials showing how to use validation controls to validate a gridview being edited? Cheers, Mike *** Sent via Developersdex http://www.developersdex.com...
1
by: Arne Garvander | last post by:
How do I validate data entry in a Gridview control. -- Arne Garvander (I program VB.Net for fun and C# to get paid.)
1
by: podpi | last post by:
Hello I'm having a bit of a proooblem. I have a gridview which has a checkbox as one of the templatecolumn's. When it is checked, it hides a textbox containing a DateTime templatefield...
1
parshupooja
by: parshupooja | last post by:
Hey all, I have gridview with 6 columns and 7 rows in item template day, date, min, mout, ain, aout min, mout, ain, aout are textboxes. Its basicaly a timesheet and its not necessary that user...
11
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.