Experience with Master Pages anyone?  | |
April 7th, 2007, 11:14 AM
|
#1 (permalink)
| | Mobile Member
Join Date: Apr 2005 Location: S. Central PA
Posts: 3,601
| Experience with Master Pages anyone?
Back again with another Web Dev question... i really should learn more of this stuff, and with Visual Studio 2005 it shouldnt be that hard and i should learn it better.
Anyway many of you may recall the site that ive been working on for a club. www.propbustersrc.org Thats the site, and i uploaded most of the changes i have so far, i played around with a couple web photo galleries and the stuff. Unfortunately i never did that page completely right in the first place, meaning i used Dreamweaver and did a .ASP page but then i used 3 iframes to call the header, nav, and main window area. The thing that sucks about iframes are that you have to give them a set (px) height.... so they really arent a good choice there.
I never knew i could (didnt really think of it) design the whole page with ASP.NET (.aspx using C#) inside Visual Studio 2005 Pro, since i have it I should probably use it. I created a new site, read up on doing includes and realized they left them for Master Pages, so i found a tutorial on how to do them, it walked me through alot of stuff and i was utterly lost. But i still cant get the Master Page to do what i want, where I can call other pages, etc... Heres the link to the tutorial i was following: http://www.asp.net/learn/dataaccess/....aspx?tabid=63
Below you will see the .zip file of what ive worked with it so far, but still havent got it working right, all i want is to know how to get the Master Page made and have the navigation work much like the above mentioned site I worked on. Are there any samples i could take the master page from and change some directories, etc..?
Any help/suggestions/comments would be greatly appreciated... TIA 
__________________ Thinkpad T61 14.1" wide | WinXP Pro | C2D T8300 CPU | 3GB DDR2 | 160GB HDD | AGN & WWAN
Lenovo S10 10.2" LED display | 1.6Ghz Atom CPU | 1GB DDR2 | 1.3mp webcam | B/G WiFi | 160GB HDD
Last edited by ShuckyD : April 7th, 2007 at 12:58 PM.
|
| |
April 7th, 2007, 10:55 PM
|
#2 (permalink)
| | Banned
Join Date: Jan 2004 Location: Earth
Posts: 420
| Just put the navigation in the Master page and all the child pages will inherit the Master. When you make a new page in VS just select the Master page. Its really that easy! |
| |
April 8th, 2007, 12:56 AM
|
#3 (permalink)
| | Mobile Member
Join Date: Apr 2005 Location: S. Central PA
Posts: 3,601
|
alright, i somewhat understand that, but still how will i be able to get a header thats always a constant file and then a main window area as well as a navigation area, either a file i made, or like with the .zip files i attached, something i created with VS's navigation (menu) |
| |
April 9th, 2007, 11:20 AM
|
#4 (permalink)
| | Banned
Join Date: Jan 2004 Location: Earth
Posts: 420
|
Here is an example Master Page Code: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Default.master.cs" Inherits="Masters_Home" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>My Master Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<link rel="shortcut icon" type="image/ico" href="../favicon.ico" />
<link href="../Style/default.css" rel="stylesheet" type="text/css" />
<script language="JScript" type="text/jscript" src="JScripts/myscript.js" xml:space="preserve">
//<![CDATA[
//]]>
</script>
</head>
<body id="BodyStyle">
<form id="form1" runat="server">
<div class="MyNavigation"><a href="">Links 1</a> | <a href="">Link 2</a></div>
<div class="PageContainer">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html> The above will get inherited by all child pages who choose this Master. You could put your navigation under the form tag between div tags. |
| |
April 9th, 2007, 11:28 AM
|
#5 (permalink)
| | Mobile Member
Join Date: Apr 2005 Location: S. Central PA
Posts: 3,601
|
ok.. now what i currently havent isnt that impressive looking and i cant seem to get it to look like a 3-page split.. meaning the top all the way across as a header, and like a 20% left area for the nav (or fixed pixel width) and then the other for the main area, what i have now, quite frankly looks a little special |
| | | Thread Tools | Search this Thread | | | | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |