Problem with comparison validator in ASP.NET DataGrid

B

Brian Foree

I'm having the following problem with an ASP.NET page (using the .NET
Framework 1.1 and VS.NET 2003):

I have a DataGrid that has several template columns that contain validators
in the EditItemTemplate. The RequiredFieldValidators and
RegularExpressionValidators are working fine, but I have one
CompareValidator that I can't get to work. I have a TextBox in the DataGrid
that can't be greater than another TextBox that is on the same page, but not
in the DataGrid. The problem I'm having is that, although the TextBox I want
to compare to shows up in the drop-down list for the ControlToCompare
property of the CompareValidator, when I run the application and click on
the DataGrid's Edit button, I get the error message, "Unable to find control
id 'txtPercentRemaining' referenced by the 'ControlToCompare' property of
'CompareValidator1'." (txtPercentRemaining is the TextBox that isn't in the
DataGrid)

I will try to make this work by moving the TextBox that is the
"ControlToCompare" for the validator into the DataGrid - it doesn't really
matter where it's located on the page, because I will eventually make it
hidden. I have a feeling that that will work, but was wondering if anyone
else has any ideas on how I can get this to work if I leave the one TextBox
outside of the DataGrid.

Thanks in advance,

Brian Foree
Programmer
Texas Department of State Health Services
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top