hide half of a html table using code behind

Posted on 2009-12-19
Last Modified: 2012-05-08
Ok this is a html table with a few links, I want to make invisible or better disabled a few of the links using c# code behind.

I tried to split the links in two tables so I could hide the half that I want, the problem is that it wont look normal... It must still be on one line and I wasn't able to accomplish that...  

any help?
<div align="center">


		<table id="AutoNumber2" style="BORDER-COLLAPSE: collapse" borderColor="#111111" cellSpacing="0"

			cellPadding="0" width="775" border="0">


				<td width="7" background="admin_images/white_bg.gif" height="19"></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft%>" width=6 border=0 ></td>

				<td width=49 background="admin_images/<%=hbg%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=home">Home</font></A>



				<td width="2"><IMG height=19 src="admin_images/<%=hright%>" width=2 border=0 ></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft1%>" width=6 border=0 ></td>

				<td width=100 background="admin_images/<%=hbg1%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=searchorders">Order 




				<td width="2"><IMG height=19 src="admin_images/<%=hright1%>" width=2 border=0 ></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft2%>" width=6 border=0 ></td>

				<td width=100 background="admin_images/<%=hbg2%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=custmanage">Customer 




				<td width="2"><IMG height=19 src="admin_images/<%=hright2%>" width=2 border=0 ></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft3%>" width=6 border=0 ></td>

				<td width=85 background="admin_images/<%=hbg3%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=shippingconfiguration">Configuration</font></A>



				<td width="2"><IMG height=19 src="admin_images/<%=hright3%>" width=2 border=0 ></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft4%>" width=6 border=0 ></td>

				<td width=100 background="admin_images/<%=hbg4%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=inventorymanager">Inventory 




				<td width="2"><IMG height=19 src="admin_images/<%=hright4%>" width=2 border=0 ></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft5%>" width=6 border=0 ></td>

				<td width=115 background="admin_images/<%=hbg5%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=homepagewelcome">Content 




				<td width="2"><IMG height=19 src="admin_images/<%=hright5%>" width=2 border=0 ></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft6%>" width=6 border=0 ></td>

				<td width=115 background="admin_images/<%=hbg6%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=adminedit">Store 




				<td width="2"><IMG height=19 src="admin_images/<%=hright6%>" width=2 border=0 ></td>

				<td width="6"><IMG height=19 src="admin_images/<%=hleft7%>" width=6 border=0 ></td>

				<td width=52 background="admin_images/<%=hbg7%>" height=19 


					<font style="FONT-SIZE: 8pt" face="Arial"><A class="headerlinks" href="Index.aspx?id=adminreportoptions">Reports</font></A>


				<td width="2"><IMG height=19 src="admin_images/<%=hright7%>" width=2 border=0 ></td>





Open in new window

Question by:JustAskMe
    LVL 3

    Accepted Solution

    Use <asp:Table> instead of HTML table.
    Then you can assign IDs to the rows/tds, and manipulate them from code-behind.
    LVL 5

    Expert Comment

    If you want to make links disabled, use **onclick="return false"** in the anchor tag. e.g.
    <A class="headerlinks" onclick="return false" href="Index.aspx?id=searchorders">

    If you want to remove underline also, use **style="text-decoration:none"**
    <A class="headerlinks" style="text-decoration:none" onclick="return false" href="Index.aspx?id=searchorders">

    if you want to completely hide the links, use **style="display:none"**
    <A class="headerlinks" style="display:none" href="Index.aspx?id=searchorders">

    if you put the following code in your html:
    <style type="text/css">
        a.hide {
            display: none;
        a.dis {
            text-decoration: none;

    then styles could be used by applying multiple classes (separated by space) in "class" attribute. e.g
    <A class="headerlinks hide" href="Index.aspx?id=searchorders">
    <A class="headerlinks dis" onclick="return false" href="Index.aspx?id=searchorders">

    Author Comment

    EugeneLT: thanks! that makes sense.

    Can you give me a sample of the syntax, i could use to make this change?

    Thank you  

    Author Comment

    thanks I figured it out

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
    In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now