Problem with comparison validator in ASP.NET DataGrid

Discussion in 'ASP .Net Datagrid Control' started by Brian Foree, Sep 28, 2006.

  1. Brian Foree

    Brian Foree Guest

    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
    Brian Foree, Sep 28, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Foree
    Replies:
    0
    Views:
    556
    Brian Foree
    Sep 28, 2006
  2. Replies:
    4
    Views:
    880
    Richter~9.6
    Feb 13, 2007
  3. news.microsoft.com
    Replies:
    2
    Views:
    407
    Alan Silver
    Jul 22, 2007
  4. Brian Foree

    Problem with comparison validator in ASP.NET DataGrid

    Brian Foree, Sep 28, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    114
    Brian Foree
    Sep 28, 2006
  5. Deepu
    Replies:
    1
    Views:
    212
    ccc31807
    Feb 7, 2011
Loading...

Share This Page