Master Page Best Practice  
Author Message
send2randy





PostPosted: Thu Sep 14 20:58:38 CDT 2006 Top

ASP.Net >> 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?

Web Programming276  
 
 
Steve





PostPosted: Thu Sep 14 20:58:38 CDT 2006 Top

ASP.Net >> Master Page Best Practice 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




> 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?
>
>
>


 
 
LaptopHeaven





PostPosted: Thu Sep 14 21:47:59 CDT 2006 Top

ASP.Net >> Master Page Best Practice Thanks. That what I was guessing.
How about handling the <script...></script> tag inside the <head>. The ~/
does not seem to work.




>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
>
>


>> 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?
>>
>>
>>
>
>


 
 
stcheng





PostPosted: Fri Sep 15 00:30:39 CDT 2006 Top

ASP.Net >> Master Page Best Practice Hi Heaven,

Since client-side <script> tag 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 <head> section, 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.

 
 
AG





PostPosted: Fri Sep 15 09:39:45 CDT 2006 Top

ASP.Net >> Master Page Best Practice I thought that ~/ did not work with html controls.
Has this changed?

--

AG
Email: discuss at adhdata dot com





>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
>
>


>> 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?
>>
>>
>>
>
>


 
 
Steve





PostPosted: Fri Sep 15 10:13:14 CDT 2006 Top

ASP.Net >> Master Page Best Practice 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




>I thought that ~/ did not work with html controls.
> Has this changed?
>
> --
>
> AG
> Email: discuss at adhdata dot com
>
>
>


>>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
>>
>>


>>> 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?
>>>
>>>
>>>
>>
>>
>
>


 
 
AG





PostPosted: Fri Sep 15 20:44:54 CDT 2006 Top

ASP.Net >> Master Page Best Practice Ah yes, missed that.
Thanks.

--

AG
Email: discuss at adhdata dot com





> 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
>
>


>>I thought that ~/ did not work with html controls.
>> Has this changed?
>>
>> --
>>
>> AG
>> Email: discuss at adhdata dot com
>>
>>
>>


>>>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
>>>
>>>


>>>> 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?
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


 
 
stcheng





PostPosted: Wed Sep 20 04:51:14 CDT 2006 Top

ASP.Net >> Master Page Best Practice 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.