473,659 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help executing an IF TEST within MASTERPAGE, please

Hello,
I'm helping write a .net app, we are using VS2005 and asp/vb.net for
code
we are using the "masterPage.mas ter" technique, within the masterpage
we have an asp:contentplac eholder that is the place holder for the
main portion of the body of the site

my question is, is there a way to test what aspx page will be loaded
into the contentplacehol der? basically if it is our home page, that
page has a wider definition than all of our other pages. so i'd like
to test in the masterpage and if it is home.aspx then use a certain
layout, if it is anything else, then i'd like to use an alternate
layout.

any suggestions (or code examples) would be most appreciated. i'm
relatively new to .net, but have been coding for many years prior
thanks, simon

Aug 2 '06 #1
11 1454
Why not alter the master page layout from the relevent content page?

"simon" wrote:
Hello,
I'm helping write a .net app, we are using VS2005 and asp/vb.net for
code
we are using the "masterPage.mas ter" technique, within the masterpage
we have an asp:contentplac eholder that is the place holder for the
main portion of the body of the site

my question is, is there a way to test what aspx page will be loaded
into the contentplacehol der? basically if it is our home page, that
page has a wider definition than all of our other pages. so i'd like
to test in the masterpage and if it is home.aspx then use a certain
layout, if it is anything else, then i'd like to use an alternate
layout.

any suggestions (or code examples) would be most appreciated. i'm
relatively new to .net, but have been coding for many years prior
thanks, simon

Aug 2 '06 #2
My advice is not to use Master pages, as they rename tags and make scripting
more difficult.

I use includes, putting your CSS links and whatever in the headPage and
header and footer in top and bottom pages.

you can the save page as a template

<HTML>
<HEAD>
<!-- #include virtual ="/headPage.aspx" -->
</HEAD>
<BODY>
<!-- #include virtual ="/top.aspx" -->

Content here
<!-- #include virtual ="/bottom.aspx" -->
</BODY>
<HTML>
"simon" <me@here.comwro te in message
news:57******** *************** *********@4ax.c om...
Hello,
I'm helping write a .net app, we are using VS2005 and asp/vb.net for
code
we are using the "masterPage.mas ter" technique, within the masterpage
we have an asp:contentplac eholder that is the place holder for the
main portion of the body of the site

my question is, is there a way to test what aspx page will be loaded
into the contentplacehol der? basically if it is our home page, that
page has a wider definition than all of our other pages. so i'd like
to test in the masterpage and if it is home.aspx then use a certain
layout, if it is anything else, then i'd like to use an alternate
layout.

any suggestions (or code examples) would be most appreciated. i'm
relatively new to .net, but have been coding for many years prior
thanks, simon

Aug 2 '06 #3
thanks for the reply, being relatively new, i do not know how to do
that. could you expand on your answer if you don't mind. thanks

>Why not alter the master page layout from the relevent content page?

"simon" wrote:
>my question is, is there a way to test what aspx page will be loaded
into the contentplacehol der? basically if it is our home page, that
page has a wider definition than all of our other pages. so i'd like
to test in the masterpage and if it is home.aspx then use a certain
layout, if it is anything else, then i'd like to use an alternate
layout.
Aug 2 '06 #4
I'm with you there. i've run into exactly what you've said that makes
using it more difficult. right now i don't have an option to (due to
time) to undo the usage of masterpage. so i'm hoping there is
something programmaticall y i can use to fix this issue.
On Wed, 2 Aug 2006 19:14:37 +0800, "Slim" <me@here.comwro te:
>My advice is not to use Master pages, as they rename tags and make scripting
more difficult.

I use includes, putting your CSS links and whatever in the headPage and
header and footer in top and bottom pages.

you can the save page as a template

<HTML>
<HEAD>
<!-- #include virtual ="/headPage.aspx" -->
</HEAD>
<BODY>
<!-- #include virtual ="/top.aspx" -->

Content here
<!-- #include virtual ="/bottom.aspx" -->
</BODY>
<HTML>
"simon" <me@here.comwro te in message
news:57******* *************** **********@4ax. com...
>Hello,
I'm helping write a .net app, we are using VS2005 and asp/vb.net for
code
we are using the "masterPage.mas ter" technique, within the masterpage
we have an asp:contentplac eholder that is the place holder for the
main portion of the body of the site

my question is, is there a way to test what aspx page will be loaded
into the contentplacehol der? basically if it is our home page, that
page has a wider definition than all of our other pages. so i'd like
to test in the masterpage and if it is home.aspx then use a certain
layout, if it is anything else, then i'd like to use an alternate
layout.

any suggestions (or code examples) would be most appreciated. i'm
relatively new to .net, but have been coding for many years prior
thanks, simon
Aug 2 '06 #5
In article <#z************ **@TK2MSFTNGP06 .phx.gbl>, Slim <me@here.com>
writes
>My advice is not to use Master pages, as they rename tags and make
scripting more difficult.
My advice is definitely to use master pages as they are a fantastic boon
for web sites. You just have to learn how to get around the fact that
the client ID of controls is changed to cope with the fact that you
could easily have two controls with the same ID, one in the master page
and one in a content area (etc).

If you are bothered about client-side scripting, then all you need to do
is something like...

<script type="text/javascript">
function something() {
myName = <%= txtMyName.Clien tID %>.value;
}
</script>

When the page is compiled, the server-side bit of the above code is
replaced with the generated client ID, and your javascript works fine.

The same can be done for the "for" attribute of <labeltags.

Include files are a very poor and non-OO way of doing templates for your
site. Master pages have many, many advantages.

--
Alan Silver
(anything added below this line is nothing to do with me)
Aug 8 '06 #6
In article <57************ *************** *****@4ax.com>, simon
<me@here.comwri tes
>my question is, is there a way to test what aspx page will be loaded
into the contentplacehol der? basically if it is our home page, that
page has a wider definition than all of our other pages. so i'd like
to test in the masterpage and if it is home.aspx then use a certain
layout, if it is anything else, then i'd like to use an alternate layout.
Depends exactly what you need to do. For example, I have a situation
where one page needs a slightly different layout from the others. I have
two contentplacehol der controls in the master page, one inside the
<headand one in the <body>.

The one in the <headis rarely used, but in the page mentioned above,
it contains a few lines of CSS that set the layout specific to this
page. Remember, this page-specific CSS is not set in the master page, it
is in the content (.aspx) page.

If you really need to get at the name of the content page from within
the master page, use (air code, check the exact syntax)...

Request.ServerV ariables["SCRIPT_NAM E"].ToString()

which will give you the name of the .aspx file.

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
Aug 8 '06 #7

"Alan Silver" <al*********@no spam.thanx.inva lidwrote in message
news:Zs******** ******@nospamth ankyou.spam...
In article <#z************ **@TK2MSFTNGP06 .phx.gbl>, Slim <me@here.com>
writes
>>My advice is not to use Master pages, as they rename tags and make
scripting more difficult.

My advice is definitely to use master pages as they are a fantastic boon
for web sites. You just have to learn how to get around the fact that
the client ID of controls is changed to cope with the fact that you
could easily have two controls with the same ID, one in the master page
and one in a content area (etc).

If you are bothered about client-side scripting, then all you need to do
is something like...

<script type="text/javascript">
function something() {
myName = <%= txtMyName.Clien tID %>.value;
}
</script>

When the page is compiled, the server-side bit of the above code is
replaced with the generated client ID, and your javascript works fine.

The same can be done for the "for" attribute of <labeltags.

why bother?

when you can simply do this below, get same result without the bother. you
can save it as a template

<HTML>
<HEAD>
<!-- #include virtual ="/headPage.htm" -->
</HEAD>
<BODY>
<!-- #include virtual ="/top.htm" -->

Content here
<!-- #include virtual ="/bottom.htm" -->
</BODY>
<HTML>

Include files are a very poor and non-OO way of doing templates for your
site. Master pages have many, many advantages.

--
Alan Silver
(anything added below this line is nothing to do with me)

Aug 9 '06 #8
In article <O$************ **@TK2MSFTNGP06 .phx.gbl>, Slim <me@here.com>
writes
>why bother?

when you can simply do this below, get same result without the bother.
you can save it as a template
Because with master pages you only have one template file instead of
three, you have a single, central place where your template coding can
take place, you have real OO access to the elements on your page and
many, many more reasons.

Sure you can use include files, but then you can use Response.Write to
generate your HTML if you want. MS don't force you to use the new
methods, but you are missing a lot if you stick with the old, outdated
way of doing things. It looks to me like you are still thinking in
calssic ASP mode.

I also used to think like you about master pages. That was before I
understood what they are and how they work. I came from classic ASP and
was trying to force ASP.NET into that programming model. You can do it
that way, but you miss many of the benefits of the new framework. If you
take time to learn the ASP.NET way of doing things, you'll find yourself
much more productive in the long run.

Just my 2c.

--
Alan Silver
(anything added below this line is nothing to do with me)
Aug 9 '06 #9

"Alan Silver" <al*********@no spam.thanx.inva lidwrote in message
news:Ec******** ******@nospamth ankyou.spam...
In article <O$************ **@TK2MSFTNGP06 .phx.gbl>, Slim <me@here.com>
writes
>>why bother?

when you can simply do this below, get same result without the bother. you
can save it as a template

Because with master pages you only have one template file instead of
three,
i think yo miss my point, the page i posted is a example, of cause i still
use the vb code behind and all the other features of .net. I just dont like
the way master pages change id names

you use the page i posted as 1 template. not 3,
you have a single, central place where your template coding can
take place, you have real OO access to the elements on your page and many,
many more reasons.
Objects can be placed in the page no probs, i cant see the diff
>
Sure you can use include files, but then you can use Response.Write to
generate your HTML if you want. MS don't force you to use the new methods,
but you are missing a lot if you stick with the old, outdated way of doing
things. It looks to me like you are still thinking in calssic ASP mode.

I also used to think like you about master pages. That was before I
understood what they are and how they work. I came from classic ASP and
was trying to force ASP.NET into that programming model. You can do it
that way, but you miss many of the benefits of the new framework. If you
take time to learn the ASP.NET way of doing things, you'll find yourself
much more productive in the long run.

Just my 2c.
What benefits?
how would it be more productive?
>
--
Alan Silver
(anything added below this line is nothing to do with me)

Aug 12 '06 #10

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

Similar topics

8
4219
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link, which when you click it bookmarks the site (much easier). The favicon is never saved if the site is bookmarked this way. Does anyone have any ideas how to fix this?? This is the code: <script language="JavaScript">
7
2383
by: Alan Bashy | last post by:
Please, guys, In need help with this. It is due in the next week. Please, help me to implement the functions in this programm especially the first three constructor. I need them guys. Please, help me. This was inspired by Exercise 7 and Programming Problem 8 in Chapter 3 of our text. I have done Exercise 7 for you: Below you will find the ADT specification for a string of characters. It represents slightly more that a minimal string...
3
2080
by: Alex Maghen | last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a MasterPage and the code that resides in the code-behind of the actual pages that USE that MasterPage. I'm noticing, for example, that the Page_Load on the specific page executes before the Page_Load of its MasterPage. Is this right? But what I really want to understand is VARIABLE SCOPE, etc. between the two. For example: Is there a way for me to write code...
2
1873
by: Andrew Robinson | last post by:
I would like to use a ContentPlaceHolder within the following. Any ideas on how to best accomplish this? <td rowspan="2" style="width: 600px; background-image: url('<asp:ContentPlaceHolder ID="ContentPlaceHolderRight" runat="server" />'); background-position: bottom right; background-repeat: no-repeat;"> I am thinking that I might have to use a set method off of the masterpage to set this but I would rather do it declaratively in my...
7
9703
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for doing it like this is that I also have had a problem in the past where the SP takes longer than the...
5
2473
by: reycri | last post by:
Hi, I need to be able to do this: var func = new Function("var me = <selfRef>; alert(me.params);"); func.params = "This is a test parameter"; window.setTimeout(func, 500); Basically, I need to add properties to a function object and access them within the function when it is executing. Therefore, I need to be
0
5558
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
1
2160
by: comp.lang.c++ | last post by:
NAME=Test PATH=../../IDE\WATCOM17\Bin LIB_PATH=../../IDE\WATCOM17\Lib INCLUDE_PATH=../../IDE\WATCOM17\Include BIN_PATH=../../Bin OBJS=$(NAME).obj LINK_FLAG= d all op inc op m op maxe=25 op q op symf
5
3296
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8525
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.