Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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
  #1 (permalink)  
Old February 15th, 2007, 08:15 PM
Authorized User
 
Join Date: Dec 2005
Location: , Colorado, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rdove84
Default Code Render Block to hide table

I have a table with contact information located in an ASP.NET left navigation page that also holds a dynamic menu. When certain content pages are requested I wish to hide the contact info.

I was directed to look at using a code render block to set a display style to "block" or "none" and then use the code behind to specify the pages. However, I have no experience using code render blocks short of declaring page directives and I'm not sure how I would like the code block to the code behind.

Could someone point me in the right direction?

rdove84

  #2 (permalink)  
Old February 15th, 2007, 08:34 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

I think you do this:

In the code page:

Protected tblBlock As HTMLTable

In the front:

<table id="tblBlock" runat="server"></table>

Then in the Page Load run a function to determine if you want:

tblBlock.Visible = True [or False]

  #3 (permalink)  
Old February 15th, 2007, 08:44 PM
Authorized User
 
Join Date: Dec 2005
Location: , Colorado, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rdove84
Default

I already have an id assigned to the table so I could use that. Should I try using and if else statement to make the table visible depending on the page requested or should I use a switch? or neither?

rdove84

  #4 (permalink)  
Old February 16th, 2007, 03:14 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

Either of them would work, but since the no. of pages may be a lot, I would recommend using switch case, e.g. like below:

switch(PageID)
{
   case "1":
   tblBlock.Visible = false;
   break;
}

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
  #5 (permalink)  
Old February 16th, 2007, 01:10 PM
Authorized User
 
Join Date: Dec 2005
Location: , Colorado, USA.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rdove84
Default

Thank you both for your help.

Using the id of contact I was able to block the table from those sections of the website where they posed a problem. In case any one can use this in the future here's how I did it.

On the table I made sure it had the following:

<table id=contact runat=server>

In the code behind I set up the following under the public class:

protected System.Web.UI.HtmlControls.HtmlTable contact;

and under Page Load I set the switch to read:

switch(pageID)
{
     case "137":
    contact.Visible=false;
    break;
     case "158":
    contact.Visible=false;
    break;
     case "159":
    contact.Visible=false;
    break;
     default:
    contact.Visible=true;
    break;
}

Thanks again for your help.

rdove84

  #6 (permalink)  
Old February 16th, 2007, 05:57 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Glad you got it working and thanks for your fine manners of posting your solution.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Jump to a code block tlwms BOOK: Professional Assembly Language 0 July 16th, 2006 10:31 AM
a block of html code keyvanjan ASP.NET 1.0 and 1.1 Basics 2 July 14th, 2006 12:48 AM
Hide table with VBA mmcdonal Access VBA 5 June 24th, 2005 10:13 AM
How to hide a table TR oranginalab Javascript How-To 9 January 24th, 2005 04:35 AM
Block Table Cr0vaX Access VBA 5 June 11th, 2004 05:01 AM





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