Hi all,

I have the following code in my HTML document (ASPX page):
VB Code:
  1. function ApplyProposalAccord()
  2.     {
  3.     if (confirm("Do you wish to apply this proposal?"))
  4.     {
  5.     document.getElementById('hiddenChoice').value = 1;
  6.     document.forms[0].submit;
  7.     }
  8.     else
  9.     {
  10.     document.getElementById('hiddenChoice').value = 0;
  11.     document.forms[0].submit;
  12.     }
  13. }

The button itself is declared this way:
VB Code:
  1. Dim btnApplyProposalDetail As New WebControls.Button
  2.                     With btnApplyProposalDetail
  3.                         .ID = "btnApplyProposalDetail"
  4.                         .Text = "Apply this proposal"
  5.                         .CausesValidation = False
  6.                         s = "Are you sure you want to apply this proposal? "
  7.                         .Attributes.Add("onclick", "ApplyProposalAccord();")
  8.                         '.Attributes.Add("onclick", "btnApplyProposalDetail_Click();")
  9.                         'AddHandler btnApplyProposalDetail.Click, AddressOf btnApplyProposalDetail_Click
  10.                     End With
  11.                     placeholder1.Controls.Add(New LiteralControl("<tr bgcolor='silver'><td valign=top width=150></td><td>"))
  12.                     placeholder1.Controls.Add(btnApplyProposalDetail)
  13.                     placeholder1.Controls.Add(New LiteralControl("</td><tr>"))

In my ASPX page, the 'hiddenChoice' value is typed WithEvents System.Web.UI.HtmlControls.HtmlInputHidden. If I click on the button, the following code should be executed, but it doesn't:

VB Code:
  1. Private Sub hiddenChoice_ServerChange(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles hiddenChoice.ServerChange
  2.         If CType(hiddenChoice.Value, Integer) = 1 Then
  3.             btnApplyProposalDetail_Click()
  4.         Else
  5.             'do some other code
  6.             'do nothing
  7.         End If
  8.     End Sub

The code in the first (javascript) code doesn't fire. Does anyone know why?

I'm really disappointed... Thanx in advance...