Question

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
Was it helpful?

Solution

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

AddHandler CmdUpdate.Click, AddressOf CmdUpdate_click

OTHER TIPS

Change client side click event CmdUpdate.OnClientClick = "CmdUpdate_click()" to server side Onclick event.

CmdUpdate.OnClick = "CmdUpdate_click()

It will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top