感谢您浏览我的帖子。我在Visual Studio2010中用vb完成了一个项目。一旦用户点击提交按钮,我想要一个弹出式消息,其中包含特定的文本。我还想要一个“确定”和“取消”按钮。如果用户单击as,页面将正常运行并提交。如果单击取消,页面将返回以供用户编辑信息。
现在,我已经尝试使用msgbox,但它不能在服务器端工作。通过研究,我发现我可能需要使用Jquery。我在这方面没有太多经验,所以任何帮助都是非常感谢的!
谢谢,
乔希
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If (Not Page.IsPostBack) Then
Me.btnSubmit.Attributes.Add("onclick", "return confirm('Please note that what you have entered will be used to auto-generate the flyer. Also, submissions less than 30 days from the date entered may be denied.');")
End If
Dim objRequestID As Object = Nothing
Dim intRequestID As Integer = 0
Try
If ValidateForm() Then
Using objConnection As SqlConnection = util.GetConnection()
Using objTransaction As SqlTransaction = objConnection.BeginTransaction
Using objCommand As SqlCommand = New SqlCommand("Request_Insert", objConnection)
With objCommand
.CommandType = Data.CommandType.StoredProcedure
.Transaction = objTransaction
.Parameters.Add("@CourseTypeID", Data.SqlDbType.Int).Value = util.CourseRequestType.PIE
.Parameters.Add("@SponsorName", Data.SqlDbType.NVarChar, 50).Value = SponsorName.Text.Trim
.Parameters.Add("@SponsorPhone", Data.SqlDbType.NVarChar, 20).Value = SponsorPhone.Text.Trimenter code here发布于 2013-04-17 04:20:02
您需要在server Page_Load事件中放置client button onclick事件。
当你到达btnSubmit_Click的时候,已经太晚了。
Protected Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
If (Not Page.IsPostBack) Then
Me.btnSubmit.Attributes.Add("onclick", "return confirm('Please...');")
End If
End Sub发布于 2013-04-17 04:09:55
您可以在按钮单击时调用此javascript
<script>
function myFunction()
{
alert("I am an alert box!");
}
</script>https://stackoverflow.com/questions/16044719
复制相似问题