Search code examples
asp.netvb.netvisual-web-developer-2010contentplaceholder

button created into a Place Holder OnClientClick not working


Hi i am trying to create a Update button for my web page for a control array creasted information, it adds in the CmdUpdate button in fine, however when i click the button nothing happens.

'code to add in Update form
 CmdUpdate.Text = "Update"
    CmdUpdate.OnClientClick = "CmdUpdate_click()"
    CmdUpdate.ID = "CmdUpdate"
 PlaceHolder1.Controls.Add(CmdUpdate)

'Sub that should be called by the CmdUpdate
Private Sub CmdUpdate_click(sender As Object, e As EventArgs)
    lblPatient.Text = Globalvar.TitleNames(5)
    lblPatientName.Text = Globalvar.TitleNames(6)
    Call SQLSuff()
End Sub

Solution

  • You should be assigning a server side handler instead of a client one:

    AddHandler CmdUpdate.Click, AddressOf CmdUpdate_click