Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Visual Studio problem with BODY tag (http://www.velocityreviews.com/forums/t91394-visual-studio-problem-with-body-tag.html)

Alan No Spam 11-23-2004 10:13 PM

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?




Mark 11-24-2004 02:44 AM

Re: Visual Studio problem with BODY tag
 
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" <alan.nospam@xxxxxxxx324354.com> wrote in message
news:Ms2dnQASev-aKj7cRVn-gQ@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?
>
>
>




ChInKPoInt [No MCSD] 11-24-2004 06:42 AM

Re: Visual Studio problem with BODY tag
 
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" <mark@Z-Zvolution.nZt> wrote in message
news:co0i2j$cdg$1@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" <alan.nospam@xxxxxxxx324354.com> wrote in message
> news:Ms2dnQASev-aKj7cRVn-gQ@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?
> >
> >
> >

>
>




Mark 11-24-2004 10:30 AM

Re: Visual Studio problem with BODY tag
 
Your welcome :)
--
----------------------------------------------------------------
-**-
www.myoddjobs.co.nz :- Job auction website
-**-
Replace the Z with the e to reply
----------------------------------------------------------------

"ChInKPoInt [No MCSD]" <ChInKPoIntNOSPAMURASS@gmail.com> wrote in message
news:HYqdnRWO76TLsDncRVn-vg@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" <mark@Z-Zvolution.nZt> wrote in message
> news:co0i2j$cdg$1@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" <alan.nospam@xxxxxxxx324354.com> wrote in message
> > news:Ms2dnQASev-aKj7cRVn-gQ@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?
> > >
> > >
> > >

> >
> >

>
>





All times are GMT. The time now is 11:56 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.