[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

RE: Web User Controls

Mark Moeykens

10/23/2008 9:03:00 PM

Hi Carlo,

You shouldn't have to write anything to the output stream. If your user
control isn't rendering in your host aspx page, there may be something else
going on. I'm guessing your class called "SocialSecurityNumber" is
inheriting a TextBox control? Is there anything in your constructor logic
that is making itself invisible?

I can't give you anymore tips without seeing more code. When I run into a
problem like this, I start simple and work my way up to where I'm able to
reproduce the problem. So you may want to go simple and just manually add a
control to your table control in your web user control (ascx) and run your
host page just to see if it'll show first.

If not, delete all controls in your web user control and type in some text
and see if that shows.

If not, check your host page and make sure your user control is not in a
container whose .Visible property is set to False. Maybe something in the
Page_Load event of your host page is deleting or making the control invisible?

You get the idea.

Hope this helps,
Mark Moeykens



"Carlo Razzeto" wrote:

> Quick question....
>
> So with ASP controls, you can do the following in the code behind and have
> the control render on the webpage:
>
> TableCell Cell = TabRow.Cells(0);
> Cell.Controls.Add(new System.web.ui.webcontrols.textbox());
>
> I've created a series of web user controls, and I of course put all the UI
> HTML elements into the ascx file. What I've found is that if I do the
> following
>
> TableCell Cell = TabRow.Cells(0);
> SocialSecurityNumber txtSSN = new SocialSecurityNumber();
> txtSSN.ID = "txtSSN";
> Cell.Controls.Add(txtSSN);
>
> The control does not render on page. Anyone know if there is a trick to make
> this work? Or do all UI elements need to be written to the output stream via
> Response.Write()?
>
> Thanks
>