473,469 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Validation Control In DataGrid

Suppose I am using a series of controls in the footer of a datagrid which
allows a user to enter "a new row of information to be added to the
datagrid datasource". Some of these controls have a "RequiredValidator"
control. I am able to enter data and all is well.

On this same datagrid I have a "EditCommand" column which get the user int
the Edit/Update/Cancel mode, allowing the user to edit individual lines.
When I enter the "Edit" mode and the user enters data and presses the
"Update" link, the edits on the footer are being triggered, and it is never
reaching the "update" or "Cancel" logic.

How can I get "requiredValidator" controls in the footer to not be active
when in the edit mode?

I thought I would add the controls in code in the "Item_Created" mode and
set a flag if I was in the "Edit" mode, and if I was in the edit mode, I
would simply not add the controls to the footer. But I have been less then
successfull in adding the controls in code to the footer. I am getting a
error about the control not being well formed "Control 'txtAddMovieTitle'
of type 'TextBox' must be placed inside a form tag with runat=server.". I
have a form tag and it has a runat="Server" and my datagrid tag as well has
a "runat="Server".

Any ideas about how to get around the problem?
Nov 18 '05 #1
4 1652
Jim Heavey wrote:
How can I get "requiredValidator" controls in the footer to not be
active when in the edit mode?


myValidator.Enabled = false;
// do your thing
myValidator.Enabled = true;

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 18 '05 #2
What event should I use to change the propety back? ItemCreated?

Nov 18 '05 #3
Jim Heavey wrote:
What event should I use to change the propety back? ItemCreated?


Nope. Use the same event you used to disable the validator. Just wrap
your existing update code with those two statements and it should clear
up the problem.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 18 '05 #4
I guess I misspoke...What event would I use to set/reset the property in
the first place. I can not do it in the Edit/Update/Cancel event as it
never reaches these events because the "page is not valid". The only event
that I can see doing this in is in the item created!

Nov 18 '05 #5

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

Similar topics

0
by: Mike | last post by:
I was wondering, can you use a validation control to valid user input from a DataGrid control? Example: let say you are editing one of row. before you update the data store, you valid the row and...
1
by: Hi | last post by:
I have a ASP.Net page that has a few fields to submit to a database and a datagrid to edit the entries. I have validation controls to make sure the user enters the right info on the first few...
3
by: Ben | last post by:
Hi, I have a page with a datagrid that you have to scroll to see. I'm using the StrengthControls SmartScroller as recommended to maintain my scroll position. Anyway, inside the datagrid I have...
6
by: rodchar | last post by:
Hey all, I'm trying to implement validation in my asp.net datagrid. For example, if a user enters in a Customer ID I want it to check a different data table to see if the customer exists. I'm...
5
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
4
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are...
1
by: rmccinc | last post by:
OK, I am running into some issues that I cant figure out a work-around. I am not going to post code cause I figured out WHY my issue is happening: -I have a datagrid, and a button that fires a...
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
10
by: John Richardson | last post by:
General question about how WinForms handles undoing a change during a control's validation, if it does at all. After a change to a control's value, if the data is determined to be invalid, then in...
5
by: Peter Afonin | last post by:
Hello, I'm not an expert in Javascript, so I'm seeking an advice. As I mentioned in my previous post, I use Javascript to check whether at least one checkbox in the datagrid has been checked....
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
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,...
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,...
1
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.