lee2006
18-04-2007, 02:18 PM
Hi there
I have some text boxs that are created at runtime to hold information from an xml file
This is all fine but i also want to add a delete button at the bottom of each text box created at runtime
the code snipit I am using is
'loop for all text nodes
For i = 0 To stextcount - 1
'create strings and textboxs
Dim titletxt As New TextBox
Dim delbtn As New Button
Dim ttext As New TextBox
'add textbox properties
With titletxt
.Width = 600
.CssClass = "edittitle"
.Text = stitletext(i).InnerText.Trim
End With
With ttext
.Width = 600
.Height = 244
.TextMode = TextBoxMode.MultiLine
.Wrap = True
.Text = stext(i).InnerText.Trim
End With
End If
'add button properties
With delbtn
.CssClass = "delb"
.Text = "Delete"
.ID = "etbutton"
End With
'add control to edit panel
editt_pnl.Controls.Add(titletxt)
editt_pnl.Controls.Add(ttext)
editt_pnl.Controls.Add(delbtn)
AddHandler delbtn.Click, AddressOf delarea_Click ( problem Here)
Next i
This all works fine and the button shows but the click event does not fire when the delete buttons are clicked
my event handler is as follows
'delete button clicked
Protected Sub delarea_Click(ByVal sender As Object, ByVal e As System.EventArgs)
"code here"
End Sub
This code acording to the MSDN site should work
Anyone see what I am doing wrong
I have exsuated all what I know
Thanks any more info just ask
Lee
I have some text boxs that are created at runtime to hold information from an xml file
This is all fine but i also want to add a delete button at the bottom of each text box created at runtime
the code snipit I am using is
'loop for all text nodes
For i = 0 To stextcount - 1
'create strings and textboxs
Dim titletxt As New TextBox
Dim delbtn As New Button
Dim ttext As New TextBox
'add textbox properties
With titletxt
.Width = 600
.CssClass = "edittitle"
.Text = stitletext(i).InnerText.Trim
End With
With ttext
.Width = 600
.Height = 244
.TextMode = TextBoxMode.MultiLine
.Wrap = True
.Text = stext(i).InnerText.Trim
End With
End If
'add button properties
With delbtn
.CssClass = "delb"
.Text = "Delete"
.ID = "etbutton"
End With
'add control to edit panel
editt_pnl.Controls.Add(titletxt)
editt_pnl.Controls.Add(ttext)
editt_pnl.Controls.Add(delbtn)
AddHandler delbtn.Click, AddressOf delarea_Click ( problem Here)
Next i
This all works fine and the button shows but the click event does not fire when the delete buttons are clicked
my event handler is as follows
'delete button clicked
Protected Sub delarea_Click(ByVal sender As Object, ByVal e As System.EventArgs)
"code here"
End Sub
This code acording to the MSDN site should work
Anyone see what I am doing wrong
I have exsuated all what I know
Thanks any more info just ask
Lee