//删除
    function btnDel_onclick() {
        PageMethods.DelDepartment(id,CallBackFunction);
    }
    //回调函数
    function CallBackFunction(result){
        alert(result);
    }
       
    /// <summary>
    /// 删除部门信息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    [WebMethod]
    public static string DelDepartment(int id)
    {
        Department obj = new Department();
        obj.Id = id;
        try
        {
            int result = DepartmentManager.DeleteDepartment(obj);
            if (result == 1)
            {
                return "删除成功!";
            }
            else
                return "请单击行,选择数据!!!";
        }
        catch (Exception)
        {
            return "此部门信息已经存盘(和其它业务发生往来),不能删除!";
        }
    }应该怎么及时让他刷新?

解决方案 »

  1.   

    你在这个里面加绑定方法就行了
    if (result == 1)
                {
                    bind();
                    return "删除成功!";
                    
                }
      

  2.   


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Databind();
            }
        }    /// <summary>
        /// 显示部门信息
        /// </summary>
        private void Databind()
        {
            IList<Department> list = DepartmentManager.GetAllDepartments();
            if (list == null)
            { }
            else
            {
                repDepartment.DataSource = list;
                repDepartment.DataBind();
            }
        }
      

  3.   

    admin_one_10_1 page = new admin_one_10_1();
    page.Databind(); 返回之前加这个,不但不能刷新,反而返回值JS的回调函数接受不到
      

  4.   

    最简单的办法是在JS的回调函数里重新提交页面:
    document.forms[0].submit();
      

  5.   

    在js删除方法里判断一下返回值,如果成功window.location.reload()
      

  6.   

    你不回发页面时不会刷新的,除非你用js将对应的html页面上的记录也删除。
      

  7.   

    你在执行之后执行这个语句不久可以了吗?
     window.document.location=window.document.location.href;