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
- Next message: lyndon hughey: "Re: check for client dll??"
- Previous message: Lau Lei Cheong: "Re: ASP.NET / VS.NET 2003 won't work with ZoneAlarm firewall?"
- In reply to: Steve Gelfmann: "Can't render User Control in an ASP.NET page"
- Messages sorted by: [ date ] [ thread ]
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.
- Next message: lyndon hughey: "Re: check for client dll??"
- Previous message: Lau Lei Cheong: "Re: ASP.NET / VS.NET 2003 won't work with ZoneAlarm firewall?"
- In reply to: Steve Gelfmann: "Can't render User Control in an ASP.NET page"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|