I've got a question: the following ASP.NET code works fully in my testproject. When I click my htmlbutton (defined protected withevents, not seeable in the code), I get a messagebox asking me what to do. Clicking yes fires the htmlbutton event, clicking no ignores it.

This is the code:
VB Code:
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         'Put user code to initialize the page here
  3.  
  4.         With btn
  5.             .InnerText = "Apply"
  6.             .ID = "Button1"
  7.             '.Attributes.Add("runat", "server")
  8.             .Visible = True
  9.         End With
  10.  
  11.         Me.Controls.Add(btn)
  12.         btn.Attributes.Add("OnClick", "javascript:if(confirm('Are you sure?') == false) return false;")
  13.     End Sub
  14.  
  15.     Private Sub btn_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.ServerClick
  16.         Response.Write("OK")
  17.     End Sub
The problem is that I can't get it to work in my real project. The confirm message is shown, if I click cancel nothing happens, and if I click ok, something happens, but the underlying event is not fired.

Could it be that the button is added to a placeholder control dynamically? Or that the button is placed within a table?

Hope anyone could help, thanx in advance,

JMvVliet