Hi,

Is there any chance I could have some help with this? I've spent ages staring at it and can't see what the problem is.

I'm trying to create a HTML table dynamically, with an Edit button and a Save button (I know I can do this with a Datagrid, but I want the flexibility).

First state - I'm running a query row by row, dynamically creating a row, some cells, and adding hte text to the cells. I also have an Edit linkbutton which I'm adding as follows:

Code:
 Dim generate As New System.Web.UI.WebControls.LinkButton 

generate.Text = "Generate"

'variable to pass when button is clicked

generate.CommandArgument = tempDate

'method to run when button is pressed

AddHandler generate.Command, New System.Web.UI.WebControls.CommandEventHandler(AddressOf generate_Click)

cell(j).Controls.Add(generate)
The Event Handler is as follows. It reloads the table and instead of printing out the text as before, it puts the text in Textboxes.


Code:
Private Sub generate_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)

isEditing = True 

Dim arg As String = e.CommandArgument

'set the selectedrow

generateNewRow = System.Convert.ToDateTime(arg)

'redraw the table

drawTable()

End Sub
Then, the second state has an Edit linkbutton in place of the Generate button, which I'm adding like this (same as the Generate button):


Code:
Dim save As New System.Web.UI.WebControls.LinkButton

save.Text = "Save "

'variable to pass when button is clicked

save.CommandArgument = tempDate

'method to run when button is pressed

AddHandler save.Command, New System.Web.UI.WebControls.CommandEventHandler(Addr  essOf save_Click)

cell(j).Controls.Add(save)

In the event handler for that, I'm just trying to print out a line to test that it works.


Code:
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)

Dim arg As String = e.CommandArgument 

'redraw the table

drawTable()

Response.Output.WriteLine("dfsd")

End Sub

As far as I can see, the syntax is the same as for the generate button. But when I click it, it just reloads hte page but the Event Handler doesn't fire.

Can anyone help?

Thanks