Re: Can't render User Control in an ASP.NET page

From: Lau Lei Cheong (leu_lc_at_yehoo.com.hk)
Date: 06/21/04


Date: Mon, 21 Jun 2004 10:43:44 +0800

You'll just see a "UserControl" placeholder there in the IDE unless you run
the page.

And in you case you won't see the usercontrol even if you run it because
both the <html> and <body> tag is missing in the aspx file.

Note that you can't place the start tag in one file and place the end tag in
another. In that case the browser and/or web server won't be able to tell
where your usercontrol should be placed.

Regards,
Lau Lei Cheong

"Steve Gelfmann" <sgelfmann@yahoo.com> ???
news:dc0ff272.0406201744.150f624b@posting.google.com ???...
> I am new to ASP.NET. So I am trying to learn from the book I just
> bought. There is a simple example of how to build a user control
> which I religiously typed into the Notepad, but the results are not
> what was expected.
> Here's what I did.
> First, I created the user control and saved it in a file
> "SimpleHeader.ascx".
>
> <%@ Control Language="VB" %>
> <html>
> <head><title>Simple User Control</title></head>
> <body>
> <h2>This is an example of a simple user control</h2>
> <i>Simple Header!</i>
> <hr />
>
> Then, I created an ASP.NET page called HomePage.aspx that included the
> control.
>
> <%@ Page Language="VB" %>
> <%@ Register TagPrefix="SimpleUserControl" TagName="Header"
> Src="SimpleHeader.ascx" %>
> <SimpleUserControl:Header
> id="ctlHeader"
> runat="server" />
> Hello!
> </body>
> </html>
>
> I stored both files in the same folder. When I try to view the page it
> just shows the contents of the HomePage.ascx file.
>
> What do I do wrong? How to make user control appear on the page?
> Thanks.



Relevant Pages

  • Re: Reload user control?
    ... you can consider customize your ascx usercontrol to expose some public ... the postback event will be the proper time you find ... | The thing is that the other user control already has been added when the ... I have a datagrid of products in the shopping ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Raising events from constituent controls
    ... and you place the infragisitics grid on a usercontrol called ... private sub infragisticsGrid_GridFilled handles infragistics.filled ... now you need to declare and raise an event in your usercontrol like this ... >> raise both standard and custom events from the user control so the form ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Problem With Winforms UserControl on VS.net design time
    ... u might have properties in ur usercontrol that might set/get values ... When the user control loads for the first time, ... Private sPath as string ... It happens when there are some unhandled exception when the ...
    (microsoft.public.dotnet.faqs)
  • Re: Trouble with using User Control in different projects
    ... Thanks for your suggestion. ... you have to recreate the UserControl. ... user control in many applications and save time laying out and coding ... the contained elements of the user control. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Stored Proc returns Numeric 0/1 values - DataGrid CheckBox wants "0"/"1" ---
    ... I have an Application that references a UserControl library and a Class ... and/or UserControl libraries. ... in a user control contained within the UserControl library. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)