473,800 Members | 2,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I make a table cells visibility depend on a session variable?

I have a table with 2 buttons in it - a SAVE button and a DELETE
button. If Session("BothBu ttons") = True, I want to show both buttons.
If Session("BothBu ttons") = False, I want to show only the SAVE button.
This would be easy to do (I just would set DeleteButton.Vi sible =
False), but the problem is that the 2 buttons are in 2 different cells
of a table, something like this:
<td align="center"> <ASP:Button id="Save" runat="server" /></td>
<td align="center"> <ASP:Button id="Delete" runat="server" /></td>
So I want an entire <TD> tag to disappear, along with the button that
is in it.
In regular ASP, you would just say something like:
<%
If Session("BothBu ttons") = True Then
Response.Write( "<td etc....")
Else
Response.Write( "<td etc ...")
End If
%>
But I think you cannot do inline code like this in ASP.net. I may be
wrong. Any help from this very helpful forum is appreciated.
Thanks,
Marvin

Nov 19 '05 #1
2 1334
You could create an asp:table with associative controls for tables
(asp:tableheade r, asp:TableCell.. .).

Nov 19 '05 #2
"COHENMARVI N" <co*********@ho tmail.com> wrote in
news:11******** **************@ f14g2000cwb.goo glegroups.com:
<td align="center"> <ASP:Button id="Save" runat="server" /></td>
<td align="center"> <ASP:Button id="Delete" runat="server" /></td>


Add a runat="server" to the <td> tag (or the <tr> tag depending on how
you've setup your tables).

Then you can turn on/off the cell.

But also make sure you adjust the columnspan too ; )

--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying.

Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com
Nov 19 '05 #3

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

Similar topics

2
11311
by: Bhavin G | last post by:
Hi there , I am pretty new at javascripting and i am having this huge problem. I am using asp.net and C# webapplication. In my asp.net aspx file I have a place holder for taking an html table dynamically. I create a html table Time | Data1 | Data2 | Data3 type, in which the columns are not fixed, hence i am building it dynamically in c# code. now after i have the html table in the webpage, I want to give user to
1
2016
by: andrewkooi | last post by:
Greetings, I have 16 links for my horizontal menu navigation as you can see in my website www.singakad.com and at present, I am using a table and javascript for this menu. Is it possible for me to create a submenu for certain cells in this horizontal menu? How do I go about doing this? Thank you in advance for any assistance given.
31
7048
by: Royal Denning | last post by:
I am designing a table with 2 columns and 20 rows. I want to insert small images (each with a link) and a text title in each cell of the table. On refresh of the page, I would like to have the contents of each cell (picture/link and associated text) rotate randomly. Note that the text titles must remain with their associated picture and link (I don't want to scramble all the elements--just rotate the entire contents of the table cell).
0
1630
by: Drew Pawlik | last post by:
Hey guys, I'm having a problem and need some help. I have an <asp:table ...> in my web page, and this table has 2 rows, the first being a header row, and the second row containing an <asp:button> to add rows to the table. Well, when I add the first row it shows up, but if I try to add any more rows, the one I added + the rest of them all disappear. I tried saving the table to a Session variable, but that didn't work. I'm not really sure...
1
1536
by: Henke | last post by:
Hello, I have created a dynamic webcontrol table with several rows. I also have a ImageButton which adds a new row to the table. After I have added a new row, and I click the ImageButton again I get: "Multiple controls with id '_ctl0' was found ..." This is what I have done:
0
2408
by: Luis Esteban Valencia | last post by:
Hello I wrote a program with code behind in C# to add row into table dynamically and the program worked very well in .Net Framework 1.1. When I run this program in .Net Framework 2.0 beta version, the program is not working as in version 1.1. So what is the problem? Microsoft declared that the version 2.0 is fully backward support, but it is not. Is that the problem with 2.0 version? I find out the problem in version 2.0. After...
1
1535
by: Jon via DotNetMonster.com | last post by:
Hi all, I have a asp.net table control placed on 'Calculator.aspx' page. The table looks like this: <div class="roiHTML" id="highAbandonRateSale" runat="server" visible="false" > <asp:Table runat="server" ID="HARS_Table" > <asp:TableRow><asp:TableCell><p>Average weekly Inbound calls offered
3
1883
by: mylog | last post by:
hi, I have a problem regarding the retrieval of data from a table. Here's is what I am doing. I have a created a table and from added the rows and columns and also data dynamically from the code in one of the function. Now I need to access that table and data on a button click, i.e. when a user clicks button I must be able to get the table information cell-wise. I have written the following code and when the user clicks the button all I get...
2
3037
by: markszlazak | last post by:
I'm a relatively slow response of table cells changing their background color with mouseover/our in IE6 (Win 2K) but the response is fine (fast) in Firefox. Why? The code is below. Sorry about the length. <html> <head> <title>Rapid Blocking Interface</title> <style> .calendar {
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10251
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.