你要用提示框,应该Response.Write("<script language='JavaScript'>alert('hi');</script>");

解决方案 »

  1.   

    把下面一句话加到Page_load里面就行了:ButtonName.attribute.add("Onclick","<script>alert('how do you do')";
      

  2.   

    但我是用ButtonColumn来激发DataGrid的删除事件,那如何加?
    ButtonColumn不能加id属性啊
      

  3.   

    页面:
    <asp:ButtonColumn Text="删除" CommandName="Delete"></asp:ButtonColumn>后台事件private void DataGrid1_DeleteCommand(object source,    System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    int id=e.Item.ItemIndex; //Here you can write down delete sentences Response.Write("the id of rows you would delete is "+id); }
      

  4.   

    Page.RegisterStartupScript("msgbox","<Script language='vbscript'>msbox('asdf')</script>");
      

  5.   

    MessageBoxOptions 值要选择Windows.Forms.MessageBoxOptions.ServiceNotification,否则会报错。具体如下:在你的项目中添加引用:System.Wimdows.Forms调用MessageBox.Show 方法  ,在指定对象的前面显示具有指定文本、标题、按钮、图标、默认按钮和选项的消息框。参数如下:[Visual Basic]
    Overloads Public Shared Function Show( _
      ByVal owner As IWin32Window, _
       ByVal text As String, _
       ByVal caption As String, _
       ByVal buttons As MessageBoxButtons, _
       ByVal icon As MessageBoxIcon, _
       ByVal defaultButton As MessageBoxDefaultButton, _
       ByVal options As MessageBoxOptions _
    ) As DialogResult参数:
    owner 
    IWin32Window,消息框将显示在其前面。 
    text 
    要在消息框中显示的文本。 
    caption 
    要在消息框的标题栏中显示的文本。 
    buttons 
    MessageBoxButtons 值之一,它指定在消息框中显示哪些按钮。 
    icon 
    MessageBoxIcon 值之一,它指定在消息框中显示哪个图标。 
    defaultButton 
    MessageBoxDefaultButton 值之一,它指定消息框的默认按钮。 
    options 
    MessageBoxOptions 值之一,它指定将用于消息框的显示和关联选项。注意:
    MessageBoxOptions 值要选择Windows.Forms.MessageBoxOptions.ServiceNotification,否则会报错。解决了吗?给我加分吧!:)
      

  6.   

    太麻烦了,用我自制的showmessage(string s)函数吧:
    private void showmessage(string msg) //自己定义一个showmessage函数
    {
    string a1,a2,a3;
    a1="<script language='javascript'>window.alert('";
    a2="')<";
    a3="/script>";
    Response.Write(a1+msg+a2+a3);  //调用script的alert显示提示框
    }然后你就自由地用showmessage()函数,里面放上你想提示的字符串就行。你还可以把alert改为confirm,就变成一个有两个按钮的提示框。
      

  7.   

    用这个吧,比较完美
    Page.RegisterStartupScript("","<script>alert('比较完美');</script>");
      

  8.   

    msgbox用在win -forms
    js---->alert用在web-forms
      

  9.   

    To wnglish(高处不胜寒):
        你这句话加在什么位置?
      

  10.   

    麻烦楼上的兄弟,当把alert改为confirm,怎样的得到它的返回值?我是刚学,帮忙好吗?
      

  11.   

    ru
    private void Page_Load(object sender, System.EventArgs e)
    {
        btnAdd.Attributes.Add("OnClick","return confirm('确定要提交吗?');");
        if(this.IsPostBack)
            return;
    }
      

  12.   

    TO  sjc0() :当把alert改为confirm,得到它的返回值的方法:
    response.write("<script language=javascript>
    var bConfirmed=window.confirm('说上几句什么');
    if (bConfirmed){
    window.open('http://...');
    }
    window.top.location='http://...';
    </script>");