My page creates linkbuttons dynamically and adds them to a table in the top row. When a user clicks on one of these i need to change the content in the table.
The problem i am having is that page_load is being called before the button handler method, thus the table is always a step behind where it should be.
Any advice on how to remedy/workaround this problem would be greatly appreciated. Thankyou.
Code snippet:
*************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack() Then
Viewstate("buttonClicked") = Application("buttonNames")(0)
End If
Dim table As New Table
table = setTable(CType(ViewState("buttonClicked"), String))
PlaceHolder1.Controls.Add(table)
End Sub
Sub Button_Handler(ByVal sender As Object, ByVal e As CommandEventArgs)
Viewstate("buttonClicked") = e.CommandArgument
End Sub
*************
The problem i am having is that page_load is being called before the button handler method, thus the table is always a step behind where it should be.
Any advice on how to remedy/workaround this problem would be greatly appreciated. Thankyou.
Code snippet:
*************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack() Then
Viewstate("buttonClicked") = Application("buttonNames")(0)
End If
Dim table As New Table
table = setTable(CType(ViewState("buttonClicked"), String))
PlaceHolder1.Controls.Add(table)
End Sub
Sub Button_Handler(ByVal sender As Object, ByVal e As CommandEventArgs)
Viewstate("buttonClicked") = e.CommandArgument
End Sub
*************