View Single Post
  #1 (permalink)  
Old March 4th, 2005, 03:07 PM
LouMattera LouMattera is offline
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Button Generation

Iam building a dynamic table with 5 cells. The first cell will be a button to be used to select that row. I am not having a problem creating the table row by row. However I can not figure out how to capture the event when the button in cell is pressed.
code sample
----------
TableRow tblRow = new TableRow();
TableCell[] tblCell - new TableCell[5];
tblCell[0] = new TableCell();
tblCell[1] = new TableCell();
..
..
tblCell[4] = new TableCell();

SelButton = new Button();
SelButton.ID = "SelBtn";
SelButton.CommandArg = "Select";
tblCell[0].Controls.Add(SelButton);
// add remaining cells
tblRow.Cells.AddRange(tblCell);
Table1.Rows.Add(tblRow);

I can not figure out how I dynamically add the
'OnCommand = "CommandBtn_Clicked" ' to the button.

Any and all help is welcomed.