ControlToValidate

D

David

Hi,

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?

Thanks

David
 
A

Andrew Backer

Trying to do this as well, in a few minutes. Have you mucked about
with the .ClientId field, and not the .ID?
 
D

David

Yes I have. Depending on the 'container' (eg. usercontrol or other control
collection) the client ID can't be predetermined.
 
A

Andrew Backer

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
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top