2015-04-30 107 views
0

我尝试通过单击删除按钮(如果用户比在对话框中删除数据,但是当我按下删除对话框然后消失时显示jquery对话框第二次和屏幕弹出后。 我喜欢别人帮我,因为我真的jQuery的 绿色以及如何检查对话框 批准的用户代码谢谢:)通过按下按钮(无输入)显示jquery对话框

<script type="text/javascript"> 
 
     $(function() { 
 
      $("#dialog-confirm").hide(); 
 
      $("#but_Delete").click(function() { 
 
       $("#dialog-confirm").dialog({ 
 
        resizable: false, 
 
        height: 250, 
 
        width: 500, 
 
        modal: true, 
 
        buttons: { 
 
         "Delete ": function() { 
 
          $(this).dialog("close"); 
 
         }, 
 
         Cancel: function() { 
 
          $(this).dialog("close"); 
 
         } 
 
        } 
 
       }); 
 
       $(".selector").dialog({ 
 
        closeOnEscape: false 
 

 
       }); 
 
      }); 
 

 
     }); 
 
    </script>
<asp:Button ID="but_Delete" UseSubmitBehavior="false" runat="server" Height="26px" OnClick="but_Delete_Click" Text="מחק" Width="93px" />

protected void but_Delete_Click(object sender, EventArgs e) 
     {   
         if (TextBox_campeny.Text != null || TextBox_Addres.Text != null || TextBox_tel.Text != null) 
       {     
         con.Open(); 
         string id = tb.Tables[0].Rows[i]["id"].ToString(); 
         SqlCommand cmd = new SqlCommand("Delete from tbl_Customer where Id='" + id + "'", con); 
         cmd.ExecuteNonQuery();     
         Response.Write("הרשומה נמחקה בהצלחה!"); 
         con.Close(); 
         con.Open(); 
         SqlCommand cmd_u = new SqlCommand("Delete from tbl_Users where IdCustomer='" + id + "'", con); 
         SqlDataAdapter dac = new SqlDataAdapter(cmd_u); 
         dac.Fill(tb); 
         if (butuc == 1) 
         { 
          Response.Redirect("LoginPage.aspx"); 
         } 
         else 
         { 
          if(tb.Tables[0].Rows.Count != 1) 
          { 
           if (i == 0) 
           {         
            bind(); 
           } 
           else 
           { 
            if (tb.Tables[0].Rows.Count - 1 == i) 
            { 
             i--; 
             bind(); 
            } 
            else 
             bind();         
           } 
          } 
          else 
          { 
           Empty_Textbox(); 
           but_Delete.Enabled = false; 
          } 

         } 
        } 
       }          
      con.Close(); 
     } 
+0

请修复你的代码片段...它被切断一半 –

回答