在asp.net页面中显示messageBox [英] show messageBox in asp.net page

查看:105
本文介绍了在asp.net页面中显示messageBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何在asp.net页面中显示一个消息框,只要点击一个按钮就会显示。

消息框应该有是和取消作为2个按钮,其余的VB.net代码只有在点击是时才能执行。



寻求帮助这个



谢谢

Joe

Hi,

how can i show a message box in an asp.net page that would show once a button is clicked.
the message box should have "Yes" and "Cancel" as 2 buttons and the rest of the VB.net code should only be executed if "Yes" is clicked.

seeking help on this

thanks
Joe

推荐答案

你可以借助Javascript。

使用Confirm()函数。这是一个例子



you can take a help of Javascript.
use Confirm() function. here is example

function askConfirm()
{
  if(confirm("are you sure"))
    alert("you clicked Yes")
  else
    {
      alert("you clicked No") 
      return false;
    }
}





在点击提交按钮时添加此功能。



return false将取消你的执行。



在这样的ASPX页面中调用以下函数





add this function on your submit button click.

"return false" will cancel your execution.

call following function in ASPX page like this

<asp:button id="btnSubmit" runat="Server" text="Submit" onclientclick="return askConfirm()" >


你可以采取Javascript的帮助。

使用Confirm()函数。这是一个例子



you can take a help of Javascript.
use Confirm() function. here is example

function askConfirm()
{
  if(confirm("are you sure"))
    alert("you clicked Yes")
  else
    {
      alert("you clicked No") 
      return false;
    }
}





在点击提交按钮时添加此功能。



return false将取消执行。



add this function on your submit button click.

"return false" will cancel your execution.


if(result>0)
{
string myscript = "alert ('message');";
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", myscript, true);
                    return false;
}











希望这会起作用....






hope this will work....


这篇关于在asp.net页面中显示messageBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆