Custom Container Control Changes the Input Tag Names of Child Controls???

C

Chris Newby

I have a custom control that derives from the WebControls.Panel class.

In a given ASPX document, I have an instance of my custom control with ID
set to "MyControl".

Then I put a WebControls.TextBox control inside my custom control with ID
set to "MyTextBox".

When this page renderes, inspection of the HTML source shows that the Name
attribute of the input tag generated from MyTextBox is now actually
"MyControl:MyTextBox" and not just "MyTextBox".

Trying a similiar scenario, but using the standard WebControls.Panel as a
container instead of my panel-derived custom control, the input tag Name
attribute is as expected, "MyTextBox".

So, I figure I'm cleary doing something wrong.

Any thoughts?

TIA//
 
V

Vaibhav

One reasoning would be how the system treats the controls on a page. I
think in case of custom control the textbox control is taken to be part of
the custom control, but in case of a system control the inserted text box is
also taken as part of the page besides being part of the panel.

HTH
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top