|
 |
aspx_beginners thread: Replacing Banner in old ASP (include file) with .Net solution?
Message #1 by "LaBranche, Kevin" <klabranche@c...> on Fri, 7 Mar 2003 08:05:46 -0700
|
|
What's the best way to replace my old ASP include file that is called from
all my pages to generate a banner at the top of the page in ASP.Net?
The banner was generated via a sub call in the old ASP. This sub took a few
parameters that changed the appearance of the banner for each page.
How would I do this in ASP.Net? (I am assuming properties are the best way
now).
So far from what I can tell it would be a custom control....
I tried a user control but I can't move that to a central location for all
my pages to use.
Any pointers, suggestions?
Thanks,
Kevin
Message #2 by "Ben Roberts" <sucrerey@h...> on Fri, 07 Mar 2003 08:39:32 -0700
|
|
I've replaced my old functions.asp include file with a dll and i've been
real happy with the results. It's a lot speedier than the old include.
Just remeber to add the System.Web reference to your project so you can work
with the HttpResponse and HttpRequest objects.
<geek class="middle">me</geek>
From: "LaBranche, Kevin" <klabranche@c...>
Reply-To: "aspx_beginners" <aspx_beginners@p...>
To: "aspx_beginners" <aspx_beginners@p...>
Subject: [aspx_beginners] Replacing Banner in old ASP (include file) with
.Net solution?
Date: Fri, 7 Mar 2003 08:05:46 -0700
What's the best way to replace my old ASP include file that is called from
all my pages to generate a banner at the top of the page in ASP.Net?
The banner was generated via a sub call in the old ASP. This sub took a few
parameters that changed the appearance of the banner for each page.
How would I do this in ASP.Net? (I am assuming properties are the best way
now).
So far from what I can tell it would be a custom control....
I tried a user control but I can't move that to a central location for all
my pages to use.
Any pointers, suggestions?
Thanks,
Kevin
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
Message #3 by "LaBranche, Kevin" <klabranche@c...> on Fri, 7 Mar 2003 09:11:43 -0700
|
|
Ben that sounds great for most solutions were I just want to replace generic
functions. My issue I am running into is separating code from content
(HTML). My old ASP include has both HTML and VBScript but the script is
separated (Client renders HTML, Server processes Script). I would include
my file then I would call the Function to create my banner. The VBScript
function was server side with the HTML in between the function execution as
shown below. I would like to replace this with a .Net solution that
separates the code from the HTML as much as possible. I first did this with
a user control and I loved the results. HTML and code were easily
separated.
Using a custom control though seems to combine the HTML in with the code.
AKA - I overrode the Render routine and created a big HTML string of my
banner and wrote that to the browser. I am trying to avoid that as much as
possible.
Sorry if this seems muddled....
<%
<SCRIPT language="JavaScript">
if (document.images)
{
//set images in banner
}
function lightup(imgName)
{
// highlight banner item
}
function turnoff(imgName)
{
// turn off highlight for item
}
</SCRIPT>
<SCRIPT language="VBScript">
Public Sub CreateHeader(strHelpLink, blnHeader, strTitle, strHelpTarget)
%>
<!-- BEGIN NAVIGATION.INC -->
WRITE OUT TABLE and Link Structure for banner....
<%
'build the href for the help link and insert into the below html
If strHelpLink = "" Then strHelpLink = "/help.asp"
If strHelpTarget = "" Then strHelpTarget = "_top"
%>
<td style="padding:0; width:53px"><a name="helplink" href=<%= strHelpLink %>
id="helplink"><img style="border:none;" src="/images/nav/help.gif"
width="53" height="30" alt="Help" /></a></td>
<td> </td>
<%
'print user's NT logon name to screen
strNTUsername = Request.ServerVariables("REMOTE_USER")
strNTUsername = Mid(strNTUsername, InStr(strNTUsername, "\") + 1)
%>
<td style="background:#008080; color:#FFFFFF; font:.85em
Verdana,Arial,sans-serif; padding:0; vertical-align:middle;
width:109px">Welcome <%= strNTUserName %></td>
</tr>
</table>
<!-- END NAVIGATION.INC -->
<%
strHTML = "" : strTitle="" : strHelpLink="" : blnHeader="false"
End Sub
%>
Thanks,
Kevin LaBranche
Coconino County
IT CJI Project Manager
(xxx) xxx-xxxx
For the latest information on the project visit:
http://co.coconino.az.us/cji
-----Original Message-----
From: Ben Roberts [mailto:sucrerey@h...]
Sent: Friday, March 07, 2003 8:40 AM
To: aspx_beginners
Subject: [aspx_beginners] Re: Replacing Banner in old ASP (include file)
with .Net solution?
I've replaced my old functions.asp include file with a dll and i've been
real happy with the results. It's a lot speedier than the old include.
Just remeber to add the System.Web reference to your project so you can work
with the HttpResponse and HttpRequest objects.
<geek class="middle">me</geek>
From: "LaBranche, Kevin" <klabranche@c...>
Reply-To: "aspx_beginners" <aspx_beginners@p...>
To: "aspx_beginners" <aspx_beginners@p...>
Subject: [aspx_beginners] Replacing Banner in old ASP (include file) with
.Net solution?
Date: Fri, 7 Mar 2003 08:05:46 -0700
What's the best way to replace my old ASP include file that is called from
all my pages to generate a banner at the top of the page in ASP.Net?
The banner was generated via a sub call in the old ASP. This sub took a few
parameters that changed the appearance of the banner for each page.
How would I do this in ASP.Net? (I am assuming properties are the best way
now).
So far from what I can tell it would be a custom control....
I tried a user control but I can't move that to a central location for all
my pages to use.
Any pointers, suggestions?
Thanks,
Kevin
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
Message #4 by "Peter Lanoie" <planoie@n...> on Tue, 18 Mar 2003 11:37:47 -0500
|
|
Kevin,
>I tried a user control but I can't move that to a central location for all
my pages to use.
What do you mean? I have several user controls, and I can access them from
wherever I need to for inclusion on various ASPXs. Is there a need for
custom controls over user controls? You should be able to create your
banner as a user control, then just add that control to your ASPX.
Peter
-----Original Message-----
From: LaBranche, Kevin [mailto:klabranche@c...]
Sent: Friday, March 07, 2003 10:06
To: aspx_beginners
Subject: [aspx_beginners] Replacing Banner in old ASP (include file)
with .Net solution?
What's the best way to replace my old ASP include file that is called from
all my pages to generate a banner at the top of the page in ASP.Net?
The banner was generated via a sub call in the old ASP. This sub took a few
parameters that changed the appearance of the banner for each page.
How would I do this in ASP.Net? (I am assuming properties are the best way
now).
So far from what I can tell it would be a custom control....
I tried a user control but I can't move that to a central location for all
my pages to use.
Any pointers, suggestions?
Thanks,
Kevin
|
|
 |