473,405 Members | 2,141 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,405 software developers and data experts.

Visual Studio problem with BODY tag

I am using Visual Studio 2003 and in order not to repeat body tag details in
every page

<body leftmargin=0 topmargin=0 ....

I put those details as an variable in my class:

public class WebRoot: System.Web.UI.Page {
public String my_body = "leftmargin=0 topmargin=0";
......
}

and then use the following in the default.aspx page:

<body MS_POSITIONING="GridLayout" <%=my_body%>>

Now, the problem is I cannot use "DESIGN" mode anymore, VS2003 gives me
error saying "Could not open in Design View. Please quote around a '<%%>'
block used as an attribute value or within a <SELECT> element.

However, if I put <%=my_body%> in other places in the aspx page, it works.
Only <Body> tag is the problem.. help!!!

Any solutions?

Nov 18 '05 #1
3 1774
Just an idea, you could set this information via the codebehind page..

e.g in the aspx page

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

Then from the codebehind page (.cs) go something like this;

BodyTag.attributes.add["leftmargin","0"];
BodyTag.attributes.add["topmargin","0"];

This way you will achieve the same result but be able to view the page in
design mode...

hth
Cheers
Mark
--
----------------------------------------------------------------
-**-
www.myoddjobs.co.nz :- Job auction website
-**-
Replace the Z with the e to reply
----------------------------------------------------------------

"Alan No Spam" <al*********@xxxxxxxx324354.com> wrote in message
news:Ms********************@rogers.com...
I am using Visual Studio 2003 and in order not to repeat body tag details in every page

<body leftmargin=0 topmargin=0 ....

I put those details as an variable in my class:

public class WebRoot: System.Web.UI.Page {
public String my_body = "leftmargin=0 topmargin=0";
.....
}

and then use the following in the default.aspx page:

<body MS_POSITIONING="GridLayout" <%=my_body%>>

Now, the problem is I cannot use "DESIGN" mode anymore, VS2003 gives me
error saying "Could not open in Design View. Please quote around a '<%%>'
block used as an attribute value or within a <SELECT> element.

However, if I put <%=my_body%> in other places in the aspx page, it works.
Only <Body> tag is the problem.. help!!!

Any solutions?

Nov 18 '05 #2
Thanks a lot your idea works!!!!!!!! For other people future reference, the
valid C# code should be:

- In ASPX page:
<body runat="server" id="BodyTag" MS_POSITIONING="GridLayout">

- In ASPX.CS page:
protected System.Web.UI.HtmlControls.HtmlGenericControl BodyTag;
BodyTag.Attributes.Add("leftmargin","0");
BodyTag.Attributes.Add("topmargin","0");

Regards,

C.P.
[No MCSD, No Certification]
"Mark" <ma**@Z-Zvolution.nZt> wrote in message
news:co**********@lust.ihug.co.nz...
Just an idea, you could set this information via the codebehind page..

e.g in the aspx page

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

Then from the codebehind page (.cs) go something like this;

BodyTag.attributes.add["leftmargin","0"];
BodyTag.attributes.add["topmargin","0"];

This way you will achieve the same result but be able to view the page in
design mode...

hth
Cheers
Mark
--
----------------------------------------------------------------
-**-
www.myoddjobs.co.nz :- Job auction website
-**-
Replace the Z with the e to reply
----------------------------------------------------------------

"Alan No Spam" <al*********@xxxxxxxx324354.com> wrote in message
news:Ms********************@rogers.com...
I am using Visual Studio 2003 and in order not to repeat body tag details
in
every page

<body leftmargin=0 topmargin=0 ....

I put those details as an variable in my class:

public class WebRoot: System.Web.UI.Page {
public String my_body = "leftmargin=0 topmargin=0";
.....
}

and then use the following in the default.aspx page:

<body MS_POSITIONING="GridLayout" <%=my_body%>>

Now, the problem is I cannot use "DESIGN" mode anymore, VS2003 gives me
error saying "Could not open in Design View. Please quote around a

'<%%>' block used as an attribute value or within a <SELECT> element.

However, if I put <%=my_body%> in other places in the aspx page, it works. Only <Body> tag is the problem.. help!!!

Any solutions?


Nov 18 '05 #3
Your welcome :)
--
----------------------------------------------------------------
-**-
www.myoddjobs.co.nz :- Job auction website
-**-
Replace the Z with the e to reply
----------------------------------------------------------------

"ChInKPoInt [No MCSD]" <Ch*******************@gmail.com> wrote in message
news:HY********************@rogers.com...
Thanks a lot your idea works!!!!!!!! For other people future reference, the valid C# code should be:

- In ASPX page:
<body runat="server" id="BodyTag" MS_POSITIONING="GridLayout">

- In ASPX.CS page:
protected System.Web.UI.HtmlControls.HtmlGenericControl BodyTag;
BodyTag.Attributes.Add("leftmargin","0");
BodyTag.Attributes.Add("topmargin","0");

Regards,

C.P.
[No MCSD, No Certification]
"Mark" <ma**@Z-Zvolution.nZt> wrote in message
news:co**********@lust.ihug.co.nz...
Just an idea, you could set this information via the codebehind page..

e.g in the aspx page

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

Then from the codebehind page (.cs) go something like this;

BodyTag.attributes.add["leftmargin","0"];
BodyTag.attributes.add["topmargin","0"];

This way you will achieve the same result but be able to view the page in
design mode...

hth
Cheers
Mark
--
----------------------------------------------------------------
-**-
www.myoddjobs.co.nz :- Job auction website
-**-
Replace the Z with the e to reply
----------------------------------------------------------------

"Alan No Spam" <al*********@xxxxxxxx324354.com> wrote in message
news:Ms********************@rogers.com...
I am using Visual Studio 2003 and in order not to repeat body tag

details
in
every page

<body leftmargin=0 topmargin=0 ....

I put those details as an variable in my class:

public class WebRoot: System.Web.UI.Page {
public String my_body = "leftmargin=0 topmargin=0";
.....
}

and then use the following in the default.aspx page:

<body MS_POSITIONING="GridLayout" <%=my_body%>>

Now, the problem is I cannot use "DESIGN" mode anymore, VS2003 gives me error saying "Could not open in Design View. Please quote around a

'<%%>' block used as an attribute value or within a <SELECT> element.

However, if I put <%=my_body%> in other places in the aspx page, it works. Only <Body> tag is the problem.. help!!!

Any solutions?



Nov 18 '05 #4

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

Similar topics

3
by: MEHDI | last post by:
Here is the portion of the asp pages(vb script) that fails: SrcSafeIni = "F:\Microsoft Visual Studio\VSS\441_VSS\srcsafe.ini" UserName ="Admin" Password ="" 'On Error Resume Next Set...
1
by: Martyn Fewtrell | last post by:
Does anybody have a definitive answer as to what if anything the Visual Studio generated meta tags do. <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta...
5
by: chrisfarscape | last post by:
I am having a problem getting my visual studio to recognize my option buttons within a table control. When I place <asp:TableCell> <asp:RadioButton id”test1” Text=”Test”...
4
by: Charts | last post by:
6/23/05 ..NET Development\Framework\dotnet.framework.aspnet Visual Studio 2005 Beta 2 project cannot work in IIS virtual directory I used Visual Studio 2005 Beta 2 to build a simple new...
12
by: Nathan Sokalski | last post by:
I recently upgraded to from Visual Studio .NET 2003 to Visual Studio .NET 2005. In Visual Studio .NET 2003 when I would select 'Build' it would add a *.dll with the name of the Project to a /bin/...
8
by: HELLO $$$ | last post by:
To those who are familiar to MS Visual studio : I have recently Visual Studio 2005. Please can any body tells me , when I write a code: How can I separate the files of such code from the Studio...
3
by: jimbo24 | last post by:
Hello, I have inherited a large piece of C code which was written in a non ansi compliant compiler. This compiler allowed variable declaration anywhere within a function body, whereas the...
0
by: Fred | last post by:
I am trying to build a consumer to a webservice which use soapheader. I am using Visual Studio 2003. Please see the wsdl-file below. Why is it that the SOAPHEADER is empty when I use it int the...
1
by: cnixuser | last post by:
Hello, I am having a problem that I believe is related to the way a stream reader object looks for a text file by default. What I am doing is using a StreamReader object to read the text of a text...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.