我有一個gridview,它檢查rowDataBound
event.I想根據rowDataBound.I中檢查的條件刪除一些行。嘗試將所有控件放在Panel中並隱藏該面板即,在rowDataBound事件中刪除Gridview行asp.net 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;
}
}
}
問題:
這弄亂尋呼因爲行是隱藏但頁數發生並顯示其餘可見行的頁碼。
TRY 2:
問題:
給出了錯誤:
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