Page_Load()

if (!Page.IsPostBack)
                BindData();
}protected void lstAnswer_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindData();
    }GridView每行前面有个删除按钮 删除代码
function jsDelete(theSource)
    {
    var strId = "";
    strId = theSource.parentNode.parentNode.cells[1].innerText
     var oGridView = document.getElementById("gvData");
      createXMLHttpRequest(); 
      var webFileUrl = "DealDataDelete.aspx?id=" + strId;
   
      var result = "";
      xmlHttp.open("POST", webFileUrl, false);
      xmlHttp.send("");
      result = xmlHttp.responseText; 
      if(result != "")
      {
          if(result == "ok")
          {
          window.document.form1.submit();
          window.location.href = window.location.href ;
          alert("删除成功");
          }
      }
    }DealDataDelete是在数据库里面对点击的哪行继续进行了删除但删除完以后在GridView里面还是显示那调记录 
因为Page_Load里面没有第二次的绑定代码!
有什么解决方法?

解决方案 »

  1.   

    if(result == "ok")
              {
              window.document.form1.submit();
              window.location.href = window.location.href ;
              alert("删除成功");
              }
    改成if(result == "ok")
              {
              theSource.parentElement.parentElement.removeNode( true )
              alert("删除成功");
              }
      

  2.   

    if(result=="ok")document.location.reload();
      

  3.   


    删除是否成功 if(result == "ok")
              {
              theSource.parentElement.parentElement.removeNode( true )
              alert("删除成功");
              }
     BindData();