发送确认/取消确认数据库数据?ASP.NETVB
有人能帮我吗发送确认/取消确认数据库数据?ASP.NETVB,asp.net,vb.net,confirm,Asp.net,Vb.net,Confirm,有人能帮我吗 'Method for receiving the number... 'messages = numberReceived Page.ClientScript.RegisterStartupScript(Me.GetType, "Confirmation", "<script> if (confirm('You will delete " & messages.ToString & " messages, are you sure?')) { Conf
'Method for receiving the number...
'messages = numberReceived
Page.ClientScript.RegisterStartupScript(Me.GetType, "Confirmation", "<script> if (confirm('You will delete " & messages.ToString & " messages, are you sure?')) { ConfirmOnClean() }; </script>", False)
如果单击按钮,我想向用户发送确认消息。但问题是我希望邮件上有服务器数据
例如:
|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
| You are going to delete |
| 4 messages, are you sure? |
| |
| |OK| |Cancel| |
|___________________________|
数字4通过存储过程从数据库中获取。
如果用户单击OK,它应该执行一些其他代码,如果单击cancel,它应该返回
这适用于ASP.net上使用Visual Basic的网站
请帮忙
更新:
在@T.S.回答之后,我想到了这个:
'Method for receiving the number...
'messages = numberReceived
Page.ClientScript.RegisterStartupScript(Me.GetType, "Confirmation", "<script> if (confirm('You will delete " & messages.ToString & " messages, are you sure?')) { ConfirmOnClean() }; </script>", False)
我希望这对别人有帮助 你的问题缺乏具体的代码。因此,这里有一个选择: 假设您有一些Id。您调用存储过程
Dim message as String
Using cmd as new SqlCommand(...
cmd.ExecuteNoQuery()
' retrieve your parameters here
message = cmd.Parameters(0).Value
End Using
现在,代码返回给用户,并带有您检索到的值。您可以注册脚本块以立即在页面上显示消息
例如,当用户单击“确定”时,您可以使用值设置一个隐藏字段,并调用postback
。您的aspx页面将读取该值并调用DB调用来删除值
您需要提供更多详细信息,以便在此获得更具体的解决方案问题是,我必须通过单击侦听器调用SP。这很好,但是如何将其返回到页面,以便在确认框中显示数据?然后在用户输入后,调用codebehind?@Hectorviv上的另一个方法这正是我在第二段中向您解释的,并提供了一个链接,您可以在其中看到它是如何完成的。由于您的问题没有任何特定的代码,我无法提供任何特定的答案。好的,到目前为止我已经完成了:
Page.ClientScript.RegisterStartupScript(Me.GetType,“Confirmation”,“if(confirm('您将删除“&messages.ToString&“messages,您确定吗?”){ConfirmOnClean()”,False)
并正确调用ConfirmOnClean javascript函数。如何调用codebehind上的delete方法@t-s你能详细解释一下回邮吗?@Hectorviv嘿,看看这个。这很简单。这是我在一个应用程序中做的。它工作得很好!!我从这些链接中学到了很多
If cleanStatus.Value.Equals("clean") Then
OnConfirm() 'Method for calling the stored procedure for deleting the messages.
End If
Dim message as String
Using cmd as new SqlCommand(...
cmd.ExecuteNoQuery()
' retrieve your parameters here
message = cmd.Parameters(0).Value
End Using