Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > ControlToValidate

Thread Tools


Posts: n/a

I've created a custom server control that is essentially a control
collection. Inside this is a textbox that I'm attempting to validate using a
validation control assigned to the main control collection. I have a public
property that exposes the internal textbox ID so the validation control can
get it's ID to validate.

I am running into issues where the validation control cannot, on some
occasions, locate the textbox control due to an ID naming issue. I can get
more specific but is there a general approach for something like this, other
than putting the validation control inside this control collection?



Reply With Quote
Andrew Backer
Posts: n/a
Trying to do this as well, in a few minutes. Have you mucked about
with the .ClientId field, and not the .ID?

Reply With Quote
Posts: n/a
Yes I have. Depending on the 'container' (eg. usercontrol or other control
collection) the client ID can't be predetermined.

"Andrew Backer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)
> Trying to do this as well, in a few minutes. Have you mucked about
> with the .ClientId field, and not the .ID?

Reply With Quote
Andrew Backer
Posts: n/a
True, though it depends on how many levels deep you are, right? If you
are one level down (inside another user control), then you should be
able to determine it from the parent's id (assigned in the aspx) plus
"_" + the sub-control's id? At least thats what I do, but I have a
fairly simple case. IE :

_picker.ControlToSet = this.ID + "_" + _textbox.ID;

Sorry that I can't help more...

- Andrew

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy access to the control specified in a validator's ControlToValidate property Nathan Sokalski ASP .Net 0 03-08-2010 08:23 PM
Accessing the ControlToValidate control in a Validator Nathan Sokalski ASP .Net 1 05-20-2008 10:49 PM
document.getElementById(sender.controltovalidate) attributes DaveyP ASP .Net 1 04-18-2008 12:21 PM
Custom Control needs ControlToValidate Steven Nagy ASP .Net 4 05-08-2007 03:56 AM
custom validator and ControlToValidate in a composite control... Donal McWeeney ASP .Net Building Controls 1 09-29-2004 08:45 AM