RowCommand on dynamic button

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
 
T

Tony WONG

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top