UserControl.ClientID

F

Federico

Hi everyone, the matter is about the property UserControl.ClientID.

I have an ASP.NET UserControl (called DateBox) which contains a TextBox
server control, and there is an aspx page that contains an instance of
DateBox. The page needs to put the focus into the DateBox; to do this I use a
little JScript routine, and when I prepare the routine code, of course I have
to know the ID of the HTML element; so I decided to expose the property
ClientID of the inner TextBox, and my idea was to override the
UserControl.ClientID base property. Niow the questions are:

1. Is it correct to override the UserControl.ClientID property, or I have to
define a new property for my pourpose?
2. Does ASP.NET use the UserControl.ClientID base property for some its own
pourpose?

Thanks in advance.
 
C

Chris Simmons

Hi everyone, the matter is about the property UserControl.ClientID.

I have an ASP.NET UserControl (called DateBox) which contains a TextBox
server control, and there is an aspx page that contains an instance of
DateBox. The page needs to put the focus into the DateBox; to do this I use a
little JScript routine, and when I prepare the routine code, of course I have
to know the ID of the HTML element; so I decided to expose the property
ClientID of the inner TextBox, and my idea was to override the
UserControl.ClientID base property. Niow the questions are:

1. Is it correct to override the UserControl.ClientID property, or I have to
define a new property for my pourpose?
2. Does ASP.NET use the UserControl.ClientID base property for some its own
pourpose?

Thanks in advance.

I can't tell you what's "correct," but I'll give you my opinion that
this sounds dangerous. I'd do as you alluded in #1: define a new
property. This way you won't be redefining the meaning of
UserControl.ClientID and still getting what you need.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top