|
|
|
start date: Tue, 14 Aug 2007 08:11:37 -0400,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
Mufasa
|
|
2
Eliyahu Goldin
|
|
3
Mufasa
|
|
4
Eliyahu Goldin
|
|
5
Random
|
Master pages with a onload command.
I have a master page with stuff in it. It includes the body tag and then the
asp:content tag. I want to hide some text when the page is loaded but is
made visible by a check box. All that code works fine. I have the text in a
<div> that I hide/unhide when a checkbox is clicked and it's all done at the
client level.
Problem is, to hide the text I need to call a javascript function on load.
The only place it seems to work is in the <body> command. But if I do that,
I get a warning about having a <body> command within a <div> command (the
div is part of my master page.)
Anyway around this? I would like to leave the stuff at the client side so it
responds immediately without a postback to the server.
TIA - Jeff.
Date:Tue, 14 Aug 2007 08:11:37 -0400
Author:
|
Re: Master pages with a onload command.
Move the <body> to the master page outside the div. You can always set up
the <body>'s attributes from the content page. Is it what you are after?
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Mufasa" wrote in message
news:%23eJv6um3HHA.4672@TK2MSFTNGP05.phx.gbl...
>I have a master page with stuff in it. It includes the body tag and then
>the asp:content tag. I want to hide some text when the page is loaded but
>is made visible by a check box. All that code works fine. I have the text
>in a <div> that I hide/unhide when a checkbox is clicked and it's all done
>at the client level.
>
> Problem is, to hide the text I need to call a javascript function on load.
> The only place it seems to work is in the <body> command. But if I do
> that, I get a warning about having a <body> command within a <div> command
> (the div is part of my master page.)
>
> Anyway around this? I would like to leave the stuff at the client side so
> it responds immediately without a postback to the server.
>
> TIA - Jeff.
>
>
Date:Tue, 14 Aug 2007 16:58:32 +0300
Author:
|
Re: Master pages with a onload command.
How do I set the attribute on the body tag?
Do I put a runat="server" and then add the attributes in the Page_Load
routine?
J.
"Eliyahu Goldin" wrote in
message news:OS9I3sn3HHA.4476@TK2MSFTNGP06.phx.gbl...
> Move the <body> to the master page outside the div. You can always set up
> the <body>'s attributes from the content page. Is it what you are after?
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Mufasa" wrote in message
> news:%23eJv6um3HHA.4672@TK2MSFTNGP05.phx.gbl...
>>I have a master page with stuff in it. It includes the body tag and then
>>the asp:content tag. I want to hide some text when the page is loaded but
>>is made visible by a check box. All that code works fine. I have the text
>>in a <div> that I hide/unhide when a checkbox is clicked and it's all done
>>at the client level.
>>
>> Problem is, to hide the text I need to call a javascript function on
>> load. The only place it seems to work is in the <body> command. But if I
>> do that, I get a warning about having a <body> command within a <div>
>> command (the div is part of my master page.)
>>
>> Anyway around this? I would like to leave the stuff at the client side so
>> it responds immediately without a postback to the server.
>>
>> TIA - Jeff.
>>
>>
>
>
Date:Tue, 14 Aug 2007 12:38:48 -0400
Author:
|
Re: Master pages with a onload command.
Take a look at the RegisterStartupScript method. Use that or declaratively
add your javascript call to the onload event with "window.onload = {name of
function, no parentheses}" Then it doesn't matter where your <body> tag is.
"Mufasa" wrote in message
news:%23eJv6um3HHA.4672@TK2MSFTNGP05.phx.gbl...
>I have a master page with stuff in it. It includes the body tag and then
>the asp:content tag. I want to hide some text when the page is loaded but
>is made visible by a check box. All that code works fine. I have the text
>in a <div> that I hide/unhide when a checkbox is clicked and it's all done
>at the client level.
>
> Problem is, to hide the text I need to call a javascript function on load.
> The only place it seems to work is in the <body> command. But if I do
> that, I get a warning about having a <body> command within a <div> command
> (the div is part of my master page.)
>
> Anyway around this? I would like to leave the stuff at the client side so
> it responds immediately without a postback to the server.
>
> TIA - Jeff.
>
>
Date:Tue, 14 Aug 2007 09:36:41 -0700
Author:
|
Re: Master pages with a onload command.
Yes, add runat="server". Also, give the body tag a unique id and then you
can refer it in the code-behind as
HtmlGenericControl myBodyTag.
And yes, you can add attributes in the Page_Load.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Mufasa" wrote in message
news:u5BMOEp3HHA.5724@TK2MSFTNGP05.phx.gbl...
> How do I set the attribute on the body tag?
>
> Do I put a runat="server" and then add the attributes in the Page_Load
> routine?
>
> J.
>
> "Eliyahu Goldin" wrote in
> message news:OS9I3sn3HHA.4476@TK2MSFTNGP06.phx.gbl...
>> Move the <body> to the master page outside the div. You can always set up
>> the <body>'s attributes from the content page. Is it what you are after?
>>
>> --
>> Eliyahu Goldin,
>> Software Developer
>> Microsoft MVP [ASP.NET]
>> http://msmvps.com/blogs/egoldin
>> http://usableasp.net
>>
>>
>> "Mufasa" wrote in message
>> news:%23eJv6um3HHA.4672@TK2MSFTNGP05.phx.gbl...
>>>I have a master page with stuff in it. It includes the body tag and then
>>>the asp:content tag. I want to hide some text when the page is loaded but
>>>is made visible by a check box. All that code works fine. I have the text
>>>in a <div> that I hide/unhide when a checkbox is clicked and it's all
>>>done at the client level.
>>>
>>> Problem is, to hide the text I need to call a javascript function on
>>> load. The only place it seems to work is in the <body> command. But if I
>>> do that, I get a warning about having a <body> command within a <div>
>>> command (the div is part of my master page.)
>>>
>>> Anyway around this? I would like to leave the stuff at the client side
>>> so it responds immediately without a postback to the server.
>>>
>>> TIA - Jeff.
>>>
>>>
>>
>>
>
>
Date:Tue, 14 Aug 2007 19:43:42 +0300
Author:
|
|
|