RowCommand on dynamic button

  • Thread starter Thread starter Tony WONG
  • Start date Start date
T

Tony WONG

the rowcommand is not fired by dynamic button

when the button is clicked, the page is posted back, button disspear.

some posts advise to recreate the button after postback in order to mark the
RowCommand work.

the button is created at runtime by
BtnCancellSchedule.Text = "Cancell"
BtnCancellSchedule.ID = "DDD"
BtnCancellSchedule.CommandName = "Cancell"
e.Row.Cells(4).Controls.Add(BtnCancellSchedule)

But i do not know to to recreate the button

Could you advise me some details. Thanks.

tony
 
Thanks it is fixed by

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Handles Me.Load
If Not IsPostBack Then
xxxxxxxxxxxxxxxxxxxx
Else
GridView.DataBind()
End If
End Sub
 
Back
Top