Visual Studio problem with BODY tag

G

Guest

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?
 
M

Mark

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
--
 
C

ChInKPoInt [No MCSD]

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 said:
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 said:
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
' said:
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?
 
M

Mark

Your welcome :)
--
----------------------------------------------------------------
-**-
www.myoddjobs.co.nz :- Job auction website
-**-
Replace the Z with the e to reply
----------------------------------------------------------------

ChInKPoInt said:
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 said:
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 said:
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
' said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top