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

  • Thread starter Thread starter Chris Newby
  • Start date Start date
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//
 
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
 
Back
Top