473,795 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change Textbox format when Validation fails in GridView

I have a GridView using Template columns. In my EditItemTemplat e I am using
CompareValidato rs to check data types. When validation fails, I would like to
change the border of the textbox in question.

I thought I could loop through the ValidatorCollec tion during the
RowUpdating event but couldn't get the reference to the textbox. When I made
an explicit reference to a textbox I got the message that this would need to
be done in the PreInit event. However, it failed there too.

Any ideas?

Thank you
Jan 12 '06 #1
2 2531
On Thu, 12 Jan 2006 08:31:47 -0800, Walter wrote:
I have a GridView using Template columns. In my EditItemTemplat e I am using
CompareValidato rs to check data types. When validation fails, I would like to
change the border of the textbox in question.

I thought I could loop through the ValidatorCollec tion during the
RowUpdating event but couldn't get the reference to the textbox. When I made
an explicit reference to a textbox I got the message that this would need to
be done in the PreInit event. However, it failed there too.

Any ideas?
I think that you are in the right direction. You need to use the
server-side DOM to navigate to your textbox. Thank you


Jan 12 '06 #2
I'm not really sure how to get to the server side DOM for this, especially
since the controls being validated are in an EditItemTemplat e. Being in the
template, I've found these fields aren't available like controls outside the
grid.

Also, what event can this be done in as it can't be in the RowUpdated or
PreInit event?

"intrader" wrote:
On Thu, 12 Jan 2006 08:31:47 -0800, Walter wrote:
I have a GridView using Template columns. In my EditItemTemplat e I am using
CompareValidato rs to check data types. When validation fails, I would like to
change the border of the textbox in question.

I thought I could loop through the ValidatorCollec tion during the
RowUpdating event but couldn't get the reference to the textbox. When I made
an explicit reference to a textbox I got the message that this would need to
be done in the PreInit event. However, it failed there too.

Any ideas?

I think that you are in the right direction. You need to use the
server-side DOM to navigate to your textbox.
Thank you


Jan 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1692
by: ben | last post by:
When running the code below the validation fails when the first line of my xml contains <legalEnvelope version="1.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > If I change this line to <legalEnvelope version="1.1">
3
8320
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There are a couple of people selling components... but that is not really an option for me... So, I took the plunge and modified the "WebUIValidation.js" file to make it happen... After tracing through file, I figure it out. It was actually pretty...
5
3073
by: Helen | last post by:
Hi I'm using ASP.NET's standard validators to display error messages when people don't fill in required fields on my form. The error messages currently show as soon as the form is loaded, but what I'd really like is for the error messages to only be displayed after the validation fails. Is this a feature of the standard ASP.NET validation or will I have to write custom validators if I want to do that?
2
1930
by: Oleg Ogurok | last post by:
Hi there, I have a modified ASP.NET TextBox control that formats its output as the phone number, e.g. if you enter "1234567890" it'll change the value to "123-456-7890". This is done by a javascript function called on "onblur" event of the textbox. However, it seems validation happens before the onblur event, therefore if I enter "1234567890", the validator that checks the phone number is set to "Invalid" state. How can I format the...
3
4894
by: Darin | last post by:
Is there a way to, at runtime, change a textbox to be a datetimepicker? I have a form that I allow the user to specify what field types the input boxes are. They can be regular text, integer, money, date, or date&time. So, I have the textbox and when I see that this field is a date, I want to change the textbox to a datetimepicker. Can that be done at runtime? TIA
2
2070
by: turboJeeper | last post by:
I have a form with 16 fields, 10 of which use the RequiredFieldValidator controls. I want to display a custom message when the validation fails. However, all the validators have ClientScript enabled so there is no postback. What can I hook into on the client side to execute other client side script (eg. show a hidden label or popup) if validation fails?
9
9331
by: Mark G. | last post by:
Good afternoon. I have a "Fixed/2" format applied to a textbox on its property sheet. When I type data in the textbox, it is formatted correctly. But when I update the value programatically by setting the "value" property, the text does not format. I can get around this of course by using the VBA format() command. But is there any way I could update the value in code and have it display according to the format that is specified on the...
7
11341
pradeepjain
by: pradeepjain | last post by:
hii. i am developing a new form for which validation is done using php , so the error text gets displayed also,I wanted to make a improvement for form. i.e can the textfield for which validation field be highlighted with say border:red; using php or javascript needs to be used. i am asking this bcos i am not using javascript for validation purpose in this form.
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10216
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7543
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.