Custom WebControl adding controls in the page

G

Galore

Hello,

I'm writing a custom webcontrol, and I need to make it add input hidden
controls within the tag form. Using Page.Controls.Add(control) isn't
working, it's putting the control outside the tag form, then I can't
access its data when I postback the webpage.

Does anyone here can give me a clue about this?

Thanks
 
R

Robert Koritnik

Don't use Page.Controls.Add() method. Depending on the work you shoudl
accomplich I would do it the simplest way possible and implement a compound
server control using CreateChildControls method and create your hidden
field.

You better check MSDN for that and get back for further assistance and we
will tell you which methods you really need to override.

And BTW. If your custom control won't rander anything visible (if it has
only Hidden field), that better inherit from Control class instead of
WebControl, because you don't need properties like Width, Height, Back...
blah blah blah...
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top