rowDataBound
이벤트의 일부 값을 검사하는 gridview가 있습니다. rowDataBound.I에서 검사 된 조건에 따라 일부 행을 제거하려면 Panel에 모든 컨트롤을 배치하고 해당 패널을 숨기려고했습니다. 즉,rowDataBound 이벤트 asp.net에서 Gridview 행 제거 C#
TRY 1 :
protected void grdFeatured_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//some other codes here
//IMPLEMENT FILTER ACCORDING TO ABOVE 'VIS' OUTPUT
if (vis > 0)
{
Panel1.Visible = false;
}
}
}
문제 :
이 행이기 때문에 페이징을 망쳐 놨어요 hidden하지만 페이지 수가 발생하고 나머지 보이는 행에 대한 페이지 번호가 표시됩니다.
TRY 2 :
protected void grdFeatured_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridViewRow gvr = e.Row;
if (e.Row.RowType == DataControlRowType.DataRow)
{
//some other codes here
//IMPLEMENT FILTER ACCORDING TO ABOVE 'VIS' OUTPUT
if (vis > 0)
{
gvr.Parent.Controls.RemoveAt(gvr.RowIndex);
}
}
}
문제 :
Specified argument was out of the range of valid values. Parameter name: index at gvr.Parent.Controls.RemoveAt(gvr.RowIndex);
는, 데이터 소스를 편집 할 사람을 좀 도와 싶지 않다 :
오류 제공합니다.
가 데이터 소스에서 계산 – codingbiz
아래의 링크 http://stackoverflow.com/questions/592106/how-to-delete-를 확인하시기 바랍니다 row-from-gridview – Sumant