2012-01-25 4 views
0

행을 삭제하기위한 ASP 이미지 버튼이있는 gridview가 있습니다. 행이 삭제되는 동안 페이드 효과를 구현했습니다. 괜찮아. 내 문제는 페이드 효과가 항상 작동한다는 것입니다 - 사용자가 확인을 클릭했는지 취소했는지 여부 사용자가 확인 상자를 클릭 한 경우에만 페이드 효과를 원합니다. 나는 붙어있다. 아래는 페이드 효과에 대한 내 코드입니다.Jquery의 GridView 행

function removeRow() { 
      if (confirm("Are you sure you want to delete this comment?")) { 
       $("#dnn_BlogCommentManager1_grdBlogComments td: input[type='image']").click(function() { 
        $tr = $(this).closest("tr"); 
        if ($(this).hasClass("imgDelete")) { 
         $tr.css("background-color", "red"); 
         $tr.fadeOut(500, function() { $tr.remove() }); 
        } 
       }); 
      } 
      else { 
       return false; 
      } 
     } 

은 내가 함수 내에서 클릭 이벤트를 배치 할 수 없습니다 알지만, 내가 removeRow 함수 내에서 클릭 한 행을 얻을 수있는 방법을 모르겠어요.

+0

이미 이미지에 바인딩되어 있지 않은 경우 removeRow는 어떻게 호출됩니까? – Malk

답변

0

이 덕분에 아담이 그 대신 qquery 클릭 이벤트 이외의 경우 조건의 수행, 내가 많이 ... 덕분에 우려를 보여주는 어쨌든

$(\"#dnn_BlogCommentManager1_grdBlogComments td: input[class='imgDelete']\").click(function() { 
     $tr = $(this).closest(\"tr\"); 
    if (confirm(\"Are you sure you want to delete this comment?\")) { 
     if ($(this).hasClass(\"imgDelete\")) { 
      $tr.css(\"background-color\", \"red\"); 
       $tr.fadeOut(500, function() { $tr.remove() }); 
      } 
     } 
     else { 
     return false; 
     } 
    }); 

아래 덕분처럼 클릭 이벤트 안에 넣어.