chris leeds said:
I just want to do a FrontPage include page into an aspx page and I can't
seem to. I can't seem to find a solid answer as to whether it's possible in
fp 2003 or if there's some sort of trick or hack.
I think if VS was a little more user friendly the FrontPage users who are
really motivated will use it in tandem. It's what we've been doing with
photo editors and menu making utilities and the like for a while anyway.
Maybe I'm on the dense side (I can't seem to learn flash) but every time
I've opened VS it's like alien technology to me.
</IMHO>
I agree with Jon: the best way of simulating an Include Page component
or an SSI is to use a Web User Control.
A Web User Control has an .aspx filename extension and begins with a
tag like:
<%@ Control Language="vb" %>
Then, you write any HTML you want. This is normally body-type HTML: no
<html> tag, no <head> tag, no <body> tag.
You can add code to a Web User Control just as you would to a normal
ASP.NET page. Here's an example:
<%@ Control Language="vb" %>
<script runat="server">
Sub Page_Load(sender as object, e as eventargs)
imgLogo.src = Request.ApplicationPath & "/images/" & _
Path.GetFileName(imgLogo.Src)
End Sub
</script>
<table width="100%">
<tr>
<td><img src="/images/mylogo.gif" id="imgLogo"
runat="server"></td>
<td><script>document.write(document.title);</script></td>
</tr>
</table>
The Page_Load subroutine runs whenever the Web User Control loads.
Path.GetFileName(imgLogo.Src) retrieves the name of the img file
specified in the src= attribute of the <img> tag. The properties of
this tag are accessible to server side code because the tag contains
runat="server" and id= attributes.
After retrieving the image filename, the code prepends it with the
local path to the current application and the subfolder "images". So,
the browser will always see a path like /myapp/images/mylogo.gif.
The reason for adjusting the image path is that many different pages
(in many different subfolders) might display the Web User Control, and
the path in the HTML would only be correct in a percentage of them.
So, the control figures out the correct path at run time.
I mention this not so much to illustrate path adjustment, but to
illustrate how Web User Controls can run code and customize their
results. This is something that Include Page components and normal
SSI's simply cannot do.
To use the Web User Control, you add a @Register directive like the
following at the top of the page.
<%@ Register TagPrefix="uc1" TagName="banner" Src="banner.ascx" %>
Then, you add a tag like this where you want the control to appear.
<uc1:banner id="Banner1" runat="server"></uc1:banner>
Visual Studio automates much of the work involved in creating and
using Web User Controls.
o To create the Web User Control, you just select
Add Web User Control from the Project menu.
o To add a Web User Control to a page, you drag it out of
Solution Explorer and drop it onto your Web page.
Take a look around my Web site,
http://www,interlacken.com. All of
the following are Web User Controls:
o The page banner.
o The page footer.
o The red, rounded-corner topic banners.
o The "Books" box that appears at the right of each page in
in the Web Resource Center, the Tips & Techniques Center,
and the Download Center.
o The Featured Products box that also appears at the right of
each page in these centers.
In the case of the last two, program code is providing an add rotator
effect.
Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------