Preview User Control?

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
You know in design view you can get a good sense of how things are going to look on your ASP.NET page. Except for if you have a custom user control (at least for me). All I get is a grey 20x100 box that say UserControl1 or whatever I have it named. If that was the actual size of the control that would be great, but usually the control is much larger so I have to use tables to make sure everything layouts correctly. The thing is though that I want to take advantage of grid layout, but this is hard to do if I put a calendar control under my custom control and my custom control when drawn covers the calendar control (as an example). Is there a way when your designing your custom control that if will be displayed on your form close to how it will actually look? What I mean is when you use a DataList control for instance (typed it in) and you leave out some properties all you get is a little 20x100 (approx) grey box until you go in an put your ItemTemplate then you get a rough idea of what the control will look like, is there a way to do this with your custom control. Maybe this is what the place holder control is for... I've yet to see a useful use for it...but then I am yet a newbie in ASPNET... Thanks!
 
As far as I know, Visual Studio .Net only offers support for Custom Controls (*.DLL) but not User Controls (*.ascx files) at design time. By that, I mean you won't be able to see a preview of how a User Control is going to be rendered.

As for PlaceHolder control, it is for adding controls dynamically at run time. For example:

Code:
Dim tb As New TextBox

tb.Text = "Hello World"
PlaceHolder1.Controls.Add(tb)
 
Last edited:
Back
Top