?
Solved

hide half of a html table using code behind

Posted on 2009-12-19
4
Medium Priority
?
602 Views
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">
	<center>
		<table id="AutoNumber2" style="BORDER-COLLAPSE: collapse" borderColor="#111111" cellSpacing="0"
			cellPadding="0" width="775" border="0">
			<tr>
				<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>
				<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 
							Manager</font></A>
					
				</td>
				<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 
							Manager</font></A>
					
				</td>
				<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>
				<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 
							Manager</font></A>
					
				</td>
				<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 
							Management</font></A>
					
				</td>
				<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 
							Administration</font></A>
					
				</td>
				<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>
				<td width="2"><IMG height=19 src="admin_images/<%=hright7%>" width=2 border=0 ></td>
			</tr>
		</table>
	</center>
</div>

Open in new window

0
Comment
Question by:JustAskMe
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
EugeneLT earned 2000 total points
ID: 26089378
Use <asp:Table> instead of HTML table.
Then you can assign IDs to the rows/tds, and manipulate them from code-behind.
0
 
LVL 5

Expert Comment

by:siddagrl
ID: 26089913
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;
    }
</style>

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">
or
<A class="headerlinks dis" onclick="return false" href="Index.aspx?id=searchorders">
0
 

Author Comment

by:JustAskMe
ID: 26093114
EugeneLT: thanks! that makes sense.

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

Thank you  
0
 

Author Comment

by:JustAskMe
ID: 26093152
thanks I figured it out
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

850 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