CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 12/19/2007 9:06:50 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 10 Views: 46 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
11 Items, 1 Pages 1 |< << Go >> >|
Nagash
Asp.Net User
Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 9:06:50 PM

0/0

I have a problem.

As we know when aadding runat=server to the body tag in the masterpage For example <body id="test" runat=server>

the output would be

 <body id="ct100_test"> I cannot have this.

I need to Dynamically (magically or whatever) add the ID to the body tag

So for example. We are in the page Mypage1.aspx I need the ID of the body tag to be (id="Mypage1" )

I need to change this id from Mypage1.aspx

 

How do I accomplish this?

Is it possible?

 

 

rmaiya
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 9:36:15 PM

0/0

I dont think so u can do like that. first of all can you explain why u need like that ? then I can think of alternate solution.

 

 


Raghu
(MCSD.NET, MCAD.NET, MCDBA)
[Don't forget to click on Mark as answer on the post that helped you ]
Nagash
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 9:57:31 PM

0/0

For one I have absolute control over the DOm per page.

Have you never used the technique of adding an ID to the body tag so you can change certain things with in a page?

I guess if you constantly use runat server then you dont since EVERYTHIGN would then have to be a class...... This completly ANNOYS the hell out of me. WHY in the &((^ is ct100_ added to any html tag that has the runat server??????????

 

Here is why....

MAIN reason

http://css-tricks.com/id-your-body-for-greater-css-control-and-specificity/ 

SIMPLE answer

http://www.cvwdesign.com/txp/article/89/creating-different-css-styles-using-the-body-tag 

MorningZ
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 10:10:21 PM

0/0

Nagash:

WHY in the &((^ is ct100_ added to any html tag that has the runat server??????????

 

Because MasterPage's implement "INamingContainer", that's why

And you can name the ID of the masterpage if you want....  in the PreInit event of it simply say:

Me.ID = "WhateverYouWantItToBe"

And you could even go one step futher:

 

In the .master page:

<body id="BodyTag" runat="server">


In the code behind page:

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Me.ID = "master"                          
        Dim PageName As String = HttpContext.Current.Request.ServerVariables("SCRIPT_NAME").ToLower()
        If PageName.Contains("/") Then PageName = PageName.Substring(PageName.LastIndexOf("/") + 1)
        BodyTag.ID = PageName.Replace(".aspx", String.Empty)
End Sub

 That would result in the page's <body> tag being:

<body id="master_nameofpage">

 


"If you make it idiot proof, they'll build a better idiot"
kraznodar
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 10:15:18 PM

0/0

If you understood the power of dotnet it wouldn't bother you at all.  You just need to get used to learning a new way to do things every 3 to 5 years from now on.

The answer to your question is here:

http://aspnet.4guysfromrolla.com/articles/051006-1.aspx

Nagash
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 10:39:36 PM

0/0

Hey Morningz That solution would work BUT I have toi chnage the In from my Mypage1.aspx not the master page.

 

Nagash
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 10:43:11 PM

0/0

 That actually is not the answer.

and I do understand the power of .net. In theory.

There are some things about .net that I will complain and *** about since I KNOW they are a wrong way of doing things.

Sometimes in dot net to open a dorr you need to go outside open all the windows go inside open all the dorrs except the one that needs to be open then go outside and unlock the actual door.

THAT is a pain in the ass. 

MorningZ
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/19/2007 11:34:47 PM

0/0

Nagash:

since I KNOW they are a wrong way of doing things.

 

No, it just means that it's wrong for you and your situation


You could solve this issue by simply using a class instead of the ID, so instead of:

<body id="MyPage1"> use <body class="home">

which could easily be applied to the aspx page

Me.Body.Attributes.Add("class","home")

 and your CSS could be like, and i am using examples from the links you gave above
 

instead of:

body#home p { color: #69C; }

use

body.home p { color: #69C; }


problem solved, and all without mucking with the way .NET wants to name it's controls 


"If you make it idiot proof, they'll build a better idiot"
Nagash
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/20/2007 5:46:12 AM

0/0

yes I could do that. And I will .BUT that doesnt make it right....

Done trying. Seems ASp.net MAKES you code css the wrong way *sight*

I guess most asp.net people just gave up trying to use CSS the way its supposed to and to make it even worse semantic HTML (I don't think it exists in asp.net world) is out the door.....

MorningZ
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/20/2007 1:22:16 PM

0/0

Nagash:

yes I could do that. And I will .BUT that doesnt make it right....

Done trying. Seems ASp.net MAKES you code css the wrong way *sight*

 

I have no idea how long you have been programming, but obviously it hasn't been all that long...  as you would have learned by now there is no one "right" way to do something...   just because you read that guy's blog post on "what you should do" is simply his opinion, and absolutely nothing more... 

Whatever though, you've got two solutions (and using Themes would be three) that would solve your problem, but guess that's not good enough for you.....can't say a few of us didn't try..

good luck in your future programming endeavors... perhaps sticking with HTML is the best answer

 


"If you make it idiot proof, they'll build a better idiot"
kraznodar
Asp.Net User
Re: Master page - Accessing the <body> tag WITHOUT runat = server12/20/2007 5:08:33 PM

0/0

Nagash:

There are some things about .net that I will complain and *** about since I KNOW they are a wrong way of doing things.

Sometimes in dot net to open a dorr you need to go outside open all the windows go inside open all the dorrs except the one that needs to be open then go outside and unlock the actual door.

Having done web development for over a decade I find asp.net to be easy, powerful and fast.  Particularly compared to the old C language Common Gateway Interface application development.  If you are having this much difficulty, maybe you aren't doing things right and only think you are.  The best solution there, is to find a different platform to work with since you won't listen to the guideance given by the people who actually know what they are doing.  I had the same attitude about the Oracle Corp. implementation of Java.  That is why I no longer work with it.  The problem wasn't Oracle's Java, the problem was me, so I made a change.

P. S. If you rant too much they block your account from posting any more. Just so you know.

11 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter Kit: visual web developer 2005 express edition starter kit Authors: David Sussman, Alex Homer, Pages: 312, Published: 2005
Build Your Own ASP.NET 2.0 Web Site Using C# & VB: The Ultimate ASP.NET Begginner's Guide Authors: Cristian Darie, Zak Ruvalcaba, Pages: 689, Published: 2006
Professional ASP.NET 2.0 XML Authors: Thiru Thangarathinam, Pages: 566, Published: 2005
Programming Microsoft Web Forms Authors: Douglas J. Reilly, Pages: 303, Published: 2005

Web:
CodeProject: Adding attributes to the tag when using Master ... Jun 28, 2007 ... Accessing the Master Page tag from an ASP.NET Content page; Author: Chuck ... Are you sure you have runat="server" in your body tag? ...
body tag runat=server doesn't work on master page - ASP.NET Forums body tag runat=server doesn't work on master page ... So I want to access the < body> tag which is not on the detail page - it's on the ...
Dynamically setting a MasterPage's tag style runat server attribute to your body tag In the master page. .... Master Pages and accessing the collection of WebControls ...
TheMSsForum.com >> Asp >> Access to body ID of Master Page - The ... I need to get access to the body tag which I have set up on my Master Page as: < body ID="MyBody" runat="server"> But when do something like: ...
how to access tag and it's event (onload, onunload) - ASP ... You can try to add the runat=server for the body tags, and then expose the body as a public property in the master page codebehind. ...
How to programmatically add onLoad and onUnload handlers to BODY ... the BODY tag it would still not be accessible by the page. ... to add accessing master page body tag from content page... - ASP.NET Forums accessing master page body tag from content page. ... I put a runat = "server" on the body tag and can find it with the @MasterType ...
Getting access to the Head tag in Master Pages - Rick Strahl's Web Log With the sample code above, I was able to add stylesheet with no scrollbar in my C# server code at page load. re: Getting access to the Head tag in Master ...
ColdFusion Tutorials - EasyCFM.COM <%@ master language="C#" %> Master Page ...
CodeProject: Adding attributes to the tag when using Master ... Accessing the Master Page tag from an ASP. ... . Now that the body tag is a server control, ...




Search This Site:










moving treenodes

need help in dotnetnuke 3.1.0

dottext.framework.dll in dottextweb/bin locked by an other process

file associations in visual web developer express

username who is accessing the application

login

asp.net when to use active directory authentication.

advanced .net only - javascipt and history and secure sites.

admin login stops working

login problems

x64 os doesn't delete files from vs

master pages + request.form help pleaaaase!!!

security exception with help module

docnetnuke.my-asp.net: vandalized

need advice on how to implement menu

failed to upload files with godaddy windows hosting

retrieving form values posted from an external site before authentication redirect?

need an opinion: best way to display the catalog zone

listbox view text by index

dotnetnuke 3.0.12 runs really slowly

asp menu using sitemapdatasource

using asp.net 2.0 membership and role providers for single sign on

catagories and meta data and km

gridview adapater column css style, how to get it?

inter module communication?

download visual web developer express edition 2005

register link redirects to home page

system.net.sockets.socketexception+webservice+sourabh das

asp.net 2.0 treeview indentation problems

installation error creating portal ! " error: path cannot be the empty string or all whitespace."

 
All Times Are GMT