Table cells as buttons


    Sponsored Links


  • 1. Node Index on the client
    I can get a selected node index on the client side. It looks like this: "" I also load the whole xml data using an xml tag. Using that index is there a way to find a corresponding element from the xml data? Thanks
  • 2. linkbutton same as command button?
    The linkbutton seems to add javascript code <script language="javascript"><!- function __doPostBack(eventTarget, eventArgument) var theform = document.WebForm3 theform.__EVENTTARGET.value = eventTarget theform.__EVENTARGUMENT.value = eventArgument theform.submit() // --></script and end up in the form collection __EVENTTARGET with the naming: UserControlName:ComandNameThatIAssigned The button control ends up in the form collection by itself: UserControlName/ID:ComandNameThatIAssigned and has no javascript added to the page?
  • 3. Setting the visibilty of server controls
    Hi, I am using code as follows: ddNewProperty.Attributes["onfocus"]="document.getElementById('" + lblSelectedProperty.ClientID + "').style.visibility =hidden; "; to set the visibility of the above and different server controls such as textboxes and dropdownlists on my webform, but to no avail. Can someone please point out the mistake in my code? Thanks in advance
  • 4. Venn Diagram Control - any know of one other than teroid one
    Hi, Does anyone know of a contorl other than Teroid Venn Control - Freeware control for creating venn diagrams. Even if its not a free be... much appreciated Phil

Re: Table cells as buttons

Postby Robert Koritnik » Sat, 29 May 2004 16:51:55 GMT

If every cell should be clickable you can put a LinkButton in it. However
you should set style for your linkbutton like this:

.yourTableClass TD A
    display: block;
    height: 100%;

regarding to this you should set your tables CssClass property to
"yourTableClass". This will make linkbuttons in TDs act like style says.

After you have done that you create table and put linkbuttons in every cell
and connect to theirs Click/Command events. Whatever is more suitable. Which
cell is clicked? What info can be valuable for you? Row/column indexes
maybe? I don't know that. You should determine the information that is
useful for you.

Otherwise you can do another thing. You could create your own custom control
that implements IPostBackEventHandler and call on every created TableCell
Page.GetPostBackEventReference with argument for the onclick attricute to
determine your cell on postback click.

{ Clever? No just smart. }

specific cell?  I don't see a click event for the Table Web Control.
Web Controls? And how to work with the click events? Any way to group it
into an array?

Re: Table cells as buttons

Postby S2xvbSBEYXJr » Sun, 30 May 2004 04:26:06 GMT

Do you have any example code as far as how to populate the cells with linkbuttons that all connect to the same Click handler, passing the X/Y info?  That's the part I am confused about - multiple buttons calling the same click handler, rather than having to create a separate on for each button


Re: Table cells as buttons

Postby Robert Koritnik » Tue, 01 Jun 2004 23:59:45 GMT

for (int rowIndex = 0; rowIndex < someRowCount; rowIndex++)
    TableRow tr = new TableRow();
    for (int colIndex = 0; colIndex < someColumnCount; colIndex++ )
        TableCell tc = new TableCell();
        LinkButton lb = new LinkButton();
        lb.Text = " "; // or some text you need to display
        lb.CommandArgument = rowIndex.ToString() + ";" +
        lb.Command += new CommandEventHandler(this.CommonCommand);

private void CommonCommand(object sender, CommandEventArgs e)
    int rowIndex;
    int colIndex;
    string[] cellIndex = e.CommandArgument.Split(new char[] {';'});
    if (cellIndex.Length == 2)
        rowIndex = int.Parse(cellIndex[0]);
        colIndex = int.Parse(cellIndex[1]);
    // logic after this is by your own will doing whatever it is that you
need to accomplish

Don't forget to set Tables class to the one I mentioned in the earlier post
and things will work perfectly. This is just dynamicly created table... You
can aslo set other properties on the controls you create (Rows and Cells).

Hope this helps.

{ Clever? No just smart. }

linkbuttons that all connect to the same Click handler, passing the X/Y
info?  That's the part I am confused about - multiple buttons calling the
same click handler, rather than having to create a separate on for each

Re: Table cells as buttons

Postby S2xvbSBEYXJr » Sat, 05 Jun 2004 05:01:04 GMT

Most excellent - works exactly as I need! Thank you so much

Anyone else using this solution - I Had to fix one thing
string[] cellIndex = e.CommandArgument.Split(new char[] {';'})

changed to
string[] cellIndex = e.CommandArgument.ToString().Split(new char[] {';'})

Re: Table cells as buttons

Postby Robert Koritnik » Sat, 05 Jun 2004 23:05:26 GMT

Of course CommandArgument is of type object. I wrote it out of my head so I
wonder that there werent any other errors in the code... ;)

{ Clever? No just smart. }

Similar Threads:

1.Drag radio buttons into a table cell in design pane of visual stud

Yesterday I got a suggestion about the web page layout from Stas. Thanks, Stas.
However, I have a problem to drag the existing radio buttons into the table 

Case: I have a lot of radion buttons in web form. Since those radio buttons 
and textboxes and text would overlap each other, when a client user use large 
size in his web browser. Stas's suggestion is to use table.

I insert a panel into the design pane and then a table into the panel. 
However, I can not drag the radio buttons into the table. Whenever you drag 
it in, it automatically goes back to original position. Could you tell how to 
drag it into the table? 

I also try to use tab of table to create a table and drag the radio buttons 
in, but it fails.

Thank you


2.button into table cell vs 2003 .NET


I would like to be able to create a table in VB in Visual Studio
2003.Net  and then add a button to the last cell, so that when the
button is clicked, a document is opened, more than likely a word
document or a gif.

I have had a quick look through the documentation and seeing as there
is so much, I cannot seem to be able to find and example of this.

Does anyone out there have an example I could take a look at?



3.Button in dynamic table cell

How do I get a dynamically created button control to appear in a dynamically 
created table cell?

Here's what I've tried:

While objDR1.Read()
   Dim objButton As New Button
   Dim objTableRow As New TableRow
   Dim objTableCell As New TableCell
   Dim strURL As String = objDR1("URL").ToString()

   objButton.Text = "edit"
   objButton.Visible = True
   objButton.Width = New Unit(60)
   objButton.Height = New Unit(20)

   AddHandler objButton.Click, AddressOf DynamicButtonClick

   objTableCell.Text = objMember.AuthorizeGetPageRoles(strURL).Replace(",", 
   objTableCell = New TableCell
   objTableCell.Text = objDR1("DisplayName").ToString()
   objTableCell = New TableCell
   objTableCell.Text = strURL
End While

This does not work: the buttons do not show up in the table cells (in fact, 
they don't show up at all, anywhere).



4.get table cell value using javascript when cell is a dropdown list

5.add hyber link to table or table cell web control

Hi, all:

In our web application(, we are  using Table, Table Row, Table Cell 
web controls dymanically load data, we define two columns, left column likes 
header, list data titles(eg. first name, last name), right column show the 
data respectively. We would like to add a hyber link to our right column (or 
table cell), Is it doable and how to do it ? thanks.

6. Table in a cell of another table

7. table and table cell web controls

8. How To Select Rightmost Cell In Wide Table WIthout Jumping Table Moving To Left

Return to ASP.NET


Who is online

Users browsing this forum: No registered users and 12 guest