R
Rotsey
Hi
I have a ASP.NET 2.0 problem I hope you could help me with, I have had
problems trying to find an answer to this
I will be brief.
I have a user control that has only a <asp:table> tag on it.
I then want to build the control programmatically on page load.
One the controls I add to the table is a LinkButton.
The problem is that the click event I wired up does not fire.
The LinkButton is declared at the user control level like this...
....
....
Public lnk as LinkButton
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not Me.IsPostBack Then
BuildTree(15)
End If
End Sub
Public Sub BuildTrree(n as integer)
...some code here
.. lnk = new LinkButton
lnk.CommandArgument = 2
AddHandler lnk.click,AddressOf click_event
...Add control to table here
End Sub
Publi sub click_event(............)
Buildtree(sender.commandArgument)
end Sub
The issue seems to be that control needs to be declared before it calls the
click event, as if I remove the Ispostback in the page load the event fires
but of course then the BuildTree is called more than once the output is
duplicated.
Can you tell me how organise the BuildTree call so that the linkbutton click
event fires.???
Thanks
Malcolm
I have a ASP.NET 2.0 problem I hope you could help me with, I have had
problems trying to find an answer to this
I will be brief.
I have a user control that has only a <asp:table> tag on it.
I then want to build the control programmatically on page load.
One the controls I add to the table is a LinkButton.
The problem is that the click event I wired up does not fire.
The LinkButton is declared at the user control level like this...
....
....
Public lnk as LinkButton
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load
If Not Me.IsPostBack Then
BuildTree(15)
End If
End Sub
Public Sub BuildTrree(n as integer)
...some code here
.. lnk = new LinkButton
lnk.CommandArgument = 2
AddHandler lnk.click,AddressOf click_event
...Add control to table here
End Sub
Publi sub click_event(............)
Buildtree(sender.commandArgument)
end Sub
The issue seems to be that control needs to be declared before it calls the
click event, as if I remove the Ispostback in the page load the event fires
but of course then the BuildTree is called more than once the output is
duplicated.
Can you tell me how organise the BuildTree call so that the linkbutton click
event fires.???
Thanks
Malcolm