473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Master Page Best Practice

When using Master Pages, what is the best Best Practice when it comes to
images and hyperlinks on the master page? Is it better to use WebControls
(<asp:Hyperlink/>), HtmlControls (<a href="~/somewhere.aspx"
runat="server">) or using ResolveClientUrl("~/somewhere") inline?

Sep 14 '06 #1
7 2370
I prefer the second option you mentioned for most situations.
<a href="~/somewhere.aspx"runat="server">

It is optimal, giving as much functionality as is needed without any
additional overhead.
WebControls (such as Hyperlink) require more server resources than the
simple href, and the last option you mentioned is usually more of a
maintenance headache.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"LaptopHeaven" <La**********@noemail.noemailwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
When using Master Pages, what is the best Best Practice when it comes to
images and hyperlinks on the master page? Is it better to use WebControls
(<asp:Hyperlink/>), HtmlControls (<a href="~/somewhere.aspx"
runat="server">) or using ResolveClientUrl("~/somewhere") inline?

Sep 15 '06 #2
Thanks. That what I was guessing.
How about handling the <script...></scripttag inside the <head>. The ~/
does not seem to work.
"Steve C. Orr [MVP, MCSD]" <St***@Orr.netwrote in message
news:ui**************@TK2MSFTNGP04.phx.gbl...
>I prefer the second option you mentioned for most situations.
<a href="~/somewhere.aspx"runat="server">

It is optimal, giving as much functionality as is needed without any
additional overhead.
WebControls (such as Hyperlink) require more server resources than the
simple href, and the last option you mentioned is usually more of a
maintenance headache.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"LaptopHeaven" <La**********@noemail.noemailwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>When using Master Pages, what is the best Best Practice when it comes to
images and hyperlinks on the master page? Is it better to use WebControls
(<asp:Hyperlink/>), HtmlControls (<a href="~/somewhere.aspx"
runat="server">) or using ResolveClientUrl("~/somewhere") inline?


Sep 15 '06 #3
Hi Heaven,

Since client-side <scripttag can not be marked with "runat=server"(it
will make it be parsed as server-side code at compilation time), you can
consider embed some server code expression to render the dynamic resolved
path. For example:

==========================

<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" src="<%=
ResolveUrl("~/scripts/common.js") %>"></script>
...................
=========================

BTW, when using the above embeded code block in <headsection, it will
make the Page.Header.Controls collection no longer modifiable(add nor
remove subcontrols in it). Therefore, if you may consider move the script
block into other postion in page if this is the case.

Please feel free to let me know if you have any other concerns on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 15 '06 #4
AG
I thought that ~/ did not work with html controls.
Has this changed?

--

AG
Email: discuss at adhdata dot com

"Steve C. Orr [MVP, MCSD]" <St***@Orr.netwrote in message
news:ui**************@TK2MSFTNGP04.phx.gbl...
>I prefer the second option you mentioned for most situations.
<a href="~/somewhere.aspx"runat="server">

It is optimal, giving as much functionality as is needed without any
additional overhead.
WebControls (such as Hyperlink) require more server resources than the
simple href, and the last option you mentioned is usually more of a
maintenance headache.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"LaptopHeaven" <La**********@noemail.noemailwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>When using Master Pages, what is the best Best Practice when it comes to
images and hyperlinks on the master page? Is it better to use WebControls
(<asp:Hyperlink/>), HtmlControls (<a href="~/somewhere.aspx"
runat="server">) or using ResolveClientUrl("~/somewhere") inline?


Sep 15 '06 #5
It does work as long as you add the runat=server attribute.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"AG" <NO**********@newsgroups.nospamwrote in message
news:et**************@TK2MSFTNGP02.phx.gbl...
>I thought that ~/ did not work with html controls.
Has this changed?

--

AG
Email: discuss at adhdata dot com

"Steve C. Orr [MVP, MCSD]" <St***@Orr.netwrote in message
news:ui**************@TK2MSFTNGP04.phx.gbl...
>>I prefer the second option you mentioned for most situations.
<a href="~/somewhere.aspx"runat="server">

It is optimal, giving as much functionality as is needed without any
additional overhead.
WebControls (such as Hyperlink) require more server resources than the
simple href, and the last option you mentioned is usually more of a
maintenance headache.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"LaptopHeaven" <La**********@noemail.noemailwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>When using Master Pages, what is the best Best Practice when it comes to
images and hyperlinks on the master page? Is it better to use
WebControls (<asp:Hyperlink/>), HtmlControls (<a href="~/somewhere.aspx"
runat="server">) or using ResolveClientUrl("~/somewhere") inline?



Sep 15 '06 #6
AG
Ah yes, missed that.
Thanks.

--

AG
Email: discuss at adhdata dot com

"Steve C. Orr [MVP, MCSD]" <St***@Orr.netwrote in message
news:uV**************@TK2MSFTNGP06.phx.gbl...
It does work as long as you add the runat=server attribute.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"AG" <NO**********@newsgroups.nospamwrote in message
news:et**************@TK2MSFTNGP02.phx.gbl...
>>I thought that ~/ did not work with html controls.
Has this changed?

--

AG
Email: discuss at adhdata dot com

"Steve C. Orr [MVP, MCSD]" <St***@Orr.netwrote in message
news:ui**************@TK2MSFTNGP04.phx.gbl...
>>>I prefer the second option you mentioned for most situations.
<a href="~/somewhere.aspx"runat="server">

It is optimal, giving as much functionality as is needed without any
additional overhead.
WebControls (such as Hyperlink) require more server resources than the
simple href, and the last option you mentioned is usually more of a
maintenance headache.

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
"LaptopHeaven" <La**********@noemail.noemailwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl.. .
When using Master Pages, what is the best Best Practice when it comes
to images and hyperlinks on the master page? Is it better to use
WebControls (<asp:Hyperlink/>), HtmlControls (<a
href="~/somewhere.aspx" runat="server">) or using
ResolveClientUrl("~/somewhere") inline?





Sep 16 '06 #7
Hello Heaven,

Does the further suggestion help you resolved the problem? If you have any
other questions related, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 20 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: multiformity | last post by:
So I have been working on an opensource project for a while, and decided to really try to make it look better after focusing on the functionality most of this time. Up to now, I have simply used a...
20
by: Alan Silver | last post by:
Hello, In classic ASP, I used to use two include files on each page, one before and one after the main content, to provide a consistent layout across a web site. That way I could just change the...
1
by: LilC | last post by:
I'm creating an application that has a standard layout for all pages. The information that is displayed in the layout will be dynamic based on the user that is logged in. Thus when a page is...
2
by: news.sbcglobal.net | last post by:
I hope I can explain this well enough to understand. I have a master page that is used by almost all of the pages in my site. On the master page is a table. In one of the cells in this table, I...
1
by: Paul | last post by:
Hello: I want to nlude this statement into everyone of my application's .aspx pages. <%@ Import Namespace="System.Data.SQLClient" %> What is the best practice to do this? Can I do this...
6
by: Steve | last post by:
Playing around with Master Pages for the first time and wanted to get thoughts on the best way to use them. Do most developers use a different Master Page for each section and then combine the...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
4
by: daveh551 | last post by:
I've seen reference to Nested Master Pages in some of the documentation, but I haven't been successful in creating one in VS 2005 (Framework 2.0). I just did a search on it, and "How To:...
5
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm trying to make my code as streamlined as possible, and add CSS file references dynamically when they are required, for example, if a page contains a webcontrol, then the related CSS...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.