2011-03-22 8 views
0

인덱스를 사용하는 것 외에는 gridview 열을 삭제할 수있는 다른 방법이 있습니까? gridview에 여러 개의 확인란을 사용하고 있습니다. 나는 누구의 체크 박스를 체크 모든 열을 삭제하려면 .. 내가 같이 체크 박스를 가져 오는 중 오류입니다 ..gridview 열 삭제

protected void ButtonApprove_Click(object sender, EventArgs e) 
{ 
    StringCollection sc = new StringCollection(); 
    string id = string.Empty; 
    for (int i = 0; i < GridView1.Rows.Count; i++)//loop the GridView Rows 
    { 
     //find the CheckBox 
     CheckBox cb = 
      (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox1"); 
     if (cb != null) 
     { 
      if (cb.Checked) 
      { 
       // get the id of the field to be deleted 
       id = GridView1.Rows[i].Cells[1].Text; 
       // add the id to be deleted in the StringCollection 
       sc.Add(id); 
      } 
     } 
    } 
    UpdateRecords(sc); 
} 
+0

당신이하고있는 일과 정확하게 필요한 것을 – Dotnet

+0

당신이 선택한 모든 기록을 삭제하고 싶으 시다면 – Dotnet

+0

을 정확하게 삭제하고 싶습니다. 선택한 모든 것을 삭제하고 다른 gridview에 추가하고 싶습니다 – user123

답변

0

이 이동하는 여러 항목을

확인을 삭제하는 Link 통과하십시오 다른 선택 gridivew Move