ASP.NET User control in Datagrid Footer

  • Thread starter Chamindu R Munasinghe
  • Start date
C

Chamindu R Munasinghe

Hi,
I use the asp.net datagrid footer to add new records. In the footer I
use a web user control to read a date. it is made of a text box, a required
field validator and a compare validator. When the grid is in edit mode I
hide the footer. The problem is when the datagrid footer is hidden the
required field validator of my user controls fails validation even though
the control is hidden. I am totally confused with this any help is greatly
appreciated.

Thanks
Chamindu
 
S

Scott Allen

Disable the validation controls whenever your user control is hidden
(Enabled = false).

HTH,
 
M

Michelle Stone

Do this... if your validation control is called
myValidator, myValidator.Enabled = false.

This should disable the validation control

Regards

Michelle
 
G

George Birbilis

Disable the validation controls whenever your user control is hidden
(Enabled = false).

indeed that's the trick, but it's very annoying unfortunately, in fact I
consider that behaviour a bug

an invisible validator should be a disabled validator (since if you just
wanted it to not show text but show it at the validation summary, you'd set
text=" " [a space char] and errormessage="something")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <[email protected]>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
.........................................................................
 
S

Scott Allen

I see your point, but I think a control's visibility and a control's
enabled / disabled state shouldn't be tied together. Think of a user
filling out an information form on a tabbed dialog. Not all of the
controls are visible at the same time but they all need to be
validated and stored.



Disable the validation controls whenever your user control is hidden
(Enabled = false).

indeed that's the trick, but it's very annoying unfortunately, in fact I
consider that behaviour a bug

an invisible validator should be a disabled validator (since if you just
wanted it to not show text but show it at the validation summary, you'd set
text=" " [a space char] and errormessage="something")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <[email protected]>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
........................................................................
 
P

Peter Blum

George,

This indeed is a bug. I reported it to Microsoft a few months ago and worked
with them to get it into their bug database. They will be considering it for
ASP.NET 2.0. (Read: its not guaranteed to get fixed.)

The datagrid has several bugs like this. Each of them calls the OnPreRender
method of the control but not the Render method when the containing area is
invisible. This causes problems when client-side code is output. That
happens in OnPreRender in validators and many third party controls. The
javascript is expecting to run on HTML that was output by Render. The HTML
isn't there. There are JavaScript errors.
You will find this bug:
- In the header when ShowHeader is false
- In the footer when ShowFooter is false
- In a column whose Column.Visible property is false.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)

George Birbilis said:
Disable the validation controls whenever your user control is hidden
(Enabled = false).

indeed that's the trick, but it's very annoying unfortunately, in fact I
consider that behaviour a bug

an invisible validator should be a disabled validator (since if you just
wanted it to not show text but show it at the validation summary, you'd set
text=" " [a space char] and errormessage="something")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <[email protected]>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
........................................................................
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top