在datagrid里有个BUTTON
设置了他的CommandName为delete
在datagrid的DeleteCommand事件里面做删除操作
在删除成功后 写了一个 提示语句
Response.Write(" <script> alert( '删除成功! '); </script> ");
一点确定以后 页面原有的样式就改变了为什么??该怎么解决 
急要答案!!!!被采纳的问题 得50分

解决方案 »

  1.   

    string success=@"<script>alert('删除成功!');</script>";
    ClientScript.RegisterStartupScript(this.GetType(), "clientScript", success);
      

  2.   

    不要在DeleteCommand事件中去在页面写入js,在触发DeleteCommand事件的按钮的OnClientClick属性设置为 return confirm("真的要删除么?")就可以了。
      

  3.   

    使用IFRAME隐藏一个页面 在隐藏的页面
    需要弹出提示信息时 使用隐藏页面来写
    Response.Write(" <script> alert( '删除成功! '); </script> ");就可以了 在aspx的页面中添加如下代码:
    [code=ASPX]
    <iframe src="abdc.aspx" ID="abcd" visible="false" runat="server"  style="width:0px; height:0px;" frameborder="0" ></iframe>
    [/code]在需要弹出提示的地方这样写...
     Session["cuowu"] = "提示内容";
                abcd.Visible = true;
    ...
    下面是abdc.aspx的代码<%@ Page Language="C#" AutoEventWireup="true" CodeFile="abdc.aspx.cs" Inherits="Pages_abdc" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        </div>
        </form>
    </body>
    </html>操作代码:using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;public partial class Pages_abdc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (null != Session["cuowu"])
            {
                Response.Write("<script language='javascript'>alert('" + Session["cuowu"].ToString() + "');</script>");
                Session.Remove("cuowu");
            }
        }
    }还有一种就是重新写PAGE的一些东西 这个网上很多就不一一说明
      

  4.   

    <%=alert%>
    </body>
    </html>protected string alert;
    button_click
    {
    alert = "<script>alert('删除成功');</script>";
    }
      

  5.   

    在页面上最好是不要用Response.Write上输出脚本,会破坏本身页面的结构用Page下的方法
      

  6.   

    string success=@" <script>alert('删除成功!'); </script>"; 
    ClientScript.RegisterStartupScript(this.GetType(), "clientScript", success); 这样是完全可以的
    别人的回答完全可行 怎么没给分呢 LZ太不厚道了