Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2007, 11:19 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default How to hide control and show no space?

I can hide a control via control.visible = false

But how do I prevent the control from taking up space?

In other words, I want to display a list of "officers" but only if there is a valid name associated with it. So, Ideally...I would display:

Grand Knight: John Doe
Deputy Grand Knight: Jack Smart
Chancellor: Ron Bland

however, if there is no Deputy Grand Knight I would want to hide but I wouldn't want to appear as:

Grand Knight: John Doe

Chancellor: Ron Bland

I wouldn't want the blank line. How can I "displace" the label?

Thanks,
Rob


 
Old March 18th, 2007, 02:20 AM
Authorized User
 
Join Date: Dec 2006
Posts: 36
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to deb1980
Default

Hi,

You can try using them in a div.
The code could be like:

<div id="div1" style="display:none">
text
</div>

Please note that if keep display = none, it wouldnot take any space on the page, however you have to check if there is data, the display should block, ie, style = "display:block"

Hope it helps

---
Best regards,

Debashis
 
Old March 18th, 2007, 03:28 AM
Authorized User
 
Join Date: Apr 2006
Posts: 79
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via AIM to anujrathi Send a message via MSN to anujrathi Send a message via Yahoo to anujrathi
Default

Hi, u can use style="display:none;" to hide the control & style="display:block;" to show that control.

eg.
function show(xid)
{
 xid.style.visiblity="none";
}
function(xid)
{
xid.style.visiblity="block";
}
 
Old March 18th, 2007, 09:39 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 238
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via MSN to rsearing
Default

Thank you very much--I'm going to try that!

Kind Regards,
Rob






Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide control and not take up space rsearing ASP.NET 2.0 Basics 2 August 31st, 2007 08:09 PM
HIDE/SHOW pallone Javascript How-To 11 April 16th, 2007 10:24 AM
how to show/hide forms ? ashrafzia C# 3 November 3rd, 2006 11:07 AM
show/hide row(s) eugz Beginning PHP 0 March 19th, 2006 10:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.