By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,633 Members | 1,931 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,633 IT Pros & Developers. It's quick & easy.

Visual Studio problem with BODY tag

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.