473,405 Members | 2,262 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.

Div Tag

If I use a Div tag to hide/unhide a block of controls, how exactly do I
turn it on and off in code?

<div id="MyDivTag" style="display:'none';"></div>

I am unsure of what the code would look like to toggle the value. Don't I
need a "runat=server" as well on this div tag?

Thanks in advance for your assistance!!!!!!!!
Nov 18 '05 #1
6 1028
~J~
Hi Jim

I use something like this on most of my applications, however I tend to use JavaScript as it saves trips to and from the server

Simply attach an onclick event to a button, and depending on the state of the div, make the display to none | block

HTH
Nov 18 '05 #2
~J~
Whoops

Forgot to add some sample code...

<script language="javascript" id="clientEventHandlersJS"><!-

function imgThreadChevron_onclick()
if(divMessageThread.style.display=="none"

divMessageThread.style.display="block
Form1.imgThreadChevron.src="images/styles/default/chevronDown.gif
Form1.imgThreadChevron.title="Click here to close the message thread."

els

divMessageThread.style.display="none
Form1.imgThreadChevron.src="images/styles/default/chevronUp.gif
Form1.imgThreadChevron.title="Click here to expand the message thread.

//--></script

and for the image button I use..

<IMG language="javascript" id="imgThreadChevron" title="Click here to expand the message thread." style="CURSOR: hand" onclick="return imgThreadChevron_onclick()" src="images/styles/default/chevronUp.gif" align="absMiddle">
Nov 18 '05 #3
Thanks for the code it will come in handy on other projects, but this
project, I need to set the on and off in code. It is not triggered by a a
user action. So I really need an example of setting it in code.

Nov 18 '05 #4
use the asp:panel control, it renders as a div

"Jim Heavey" <JH*****@nospam.com> wrote in message
news:Xn*************************@207.46.248.16...
Thanks for the code it will come in handy on other projects, but this
project, I need to set the on and off in code. It is not triggered by a a
user action. So I really need an example of setting it in code.

Nov 18 '05 #5
put a runat="server" in your div tag on your page
in you code
Imports System.Web.UI.HtmlControls

dim MyDivTag as htmlgenericcontrol
then
MyDivTag.visible true|false
"Jim Heavey" <JH*****@nospam.com> wrote in message
news:Xn*************************@207.46.248.16...
If I use a Div tag to hide/unhide a block of controls, how exactly do I
turn it on and off in code?

<div id="MyDivTag" style="display:'none';"></div>

I am unsure of what the code would look like to toggle the value. Don't I
need a "runat=server" as well on this div tag?

Thanks in advance for your assistance!!!!!!!!

Nov 18 '05 #6
use this
<div id="MyDivTag" style="visibility:hidden"></div>
and
to make it visible
<div id="MyDivTag" style="visibility:visible"></div>
"Jim Heavey" <JH*****@nospam.com> wrote in message
news:Xn*************************@207.46.248.16...
If I use a Div tag to hide/unhide a block of controls, how exactly do I
turn it on and off in code?

<div id="MyDivTag" style="display:'none';"></div>

I am unsure of what the code would look like to toggle the value. Don't I
need a "runat=server" as well on this div tag?

Thanks in advance for your assistance!!!!!!!!

Nov 18 '05 #7

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

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.