Hi all,
I have the following code in my HTML document (ASPX page):
VB Code:
function ApplyProposalAccord() { if (confirm("Do you wish to apply this proposal?")) { document.getElementById('hiddenChoice').value = 1; document.forms[0].submit; } else { document.getElementById('hiddenChoice').value = 0; document.forms[0].submit; } }
The button itself is declared this way:
VB Code:
Dim btnApplyProposalDetail As New WebControls.Button With btnApplyProposalDetail .ID = "btnApplyProposalDetail" .Text = "Apply this proposal" .CausesValidation = False s = "Are you sure you want to apply this proposal? " .Attributes.Add("onclick", "ApplyProposalAccord();") '.Attributes.Add("onclick", "btnApplyProposalDetail_Click();") 'AddHandler btnApplyProposalDetail.Click, AddressOf btnApplyProposalDetail_Click End With placeholder1.Controls.Add(New LiteralControl("<tr bgcolor='silver'><td valign=top width=150></td><td>")) placeholder1.Controls.Add(btnApplyProposalDetail) 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:
Private Sub hiddenChoice_ServerChange(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles hiddenChoice.ServerChange If CType(hiddenChoice.Value, Integer) = 1 Then btnApplyProposalDetail_Click() Else 'do some other code 'do nothing End If End Sub
The code in the first (javascript) code doesn't fire. Does anyone know why?
I'm really disappointed... Thanx in advance...




Reply With Quote