【问题标题】:Pop Up Window in VB.Net(aspx.vb) Code Behind在 VB.Net(aspx.vb) 代码中弹出窗口
【发布时间】:2016-06-15 04:06:48
【问题描述】:

我有 onclick 按钮,当我调试时,我发现我的 onclick 值为 NULL。任何人都知道为什么它无法为 Onclick 事件获取值。

Dim HTMLForm As New StringBuilder
HTMLForm.Append("<html>")
HTMLForm.AppendLine("<body onload='document.forms[""" & "form1" & """].submit()'>")
HTMLForm.AppendLine("<form id='form1' method='POST'>" )

'Set value to collection
SetRequestField("amount", CDec(lblTtlPayAmt.Text))

'Generate HTML content using collection
For Each kvp As KeyValuePair(Of String, String) In RequestFields
    If Not String.IsNullOrEmpty(kvp.Value) Then
        HTMLForm.AppendLine("<input type='hidden' id='" & kvp.Key & "' name='" & kvp.Key & "' value='" & kvp.Value & "' />")
    End If
Next

HTMLForm.AppendLine("<input type = 'submit' value=PayNow' onclick = '" & window.open("~/Payment/Payment.aspx") & "'/>")
HTMLForm.AppendLine("</form>")
HTMLForm.AppendLine("</body>")
HTMLForm.AppendLine("</html>")

Response.Clear()
Response.Write(HTMLForm.ToString())

【问题讨论】:

标签: asp.net vb.net


【解决方案1】:

您在添加提交按钮的行上缺少'

HTMLForm.AppendLine("<input type = 'submit' value=PayNow' ....

应该是

HTMLForm.AppendLine("<input type = 'submit' value='PayNow' ....

【讨论】:

  • 谢谢。但仍然无法用于弹出窗口。我尝试使用以下方法:HTMLForm.AppendLine("
    ") 我可以这样做吗?上面这个方法我也试试。不行。
猜你喜欢
  • 1970-01-01
  • 2019-02-21
  • 1970-01-01
  • 2011-03-13
  • 1970-01-01
  • 1970-01-01
  • 2023-04-01
  • 1970-01-01
  • 2012-09-29
相关资源
最近更新 更多