Live Chat Icon For mobile
Live Chat Icon

How to hide a row in a DataGrid if one of the Column value is zero

Platform: ASP.NET| Category: DataGrid

VB.NET


Protected Sub ItemDB(sender As Object, e As System.Web.UI.WebControls.DataGridItemEventArgs)
	If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.Item Then
		If e.Item.Cells(8).Text = '0' Then
			e.Item.Visible = False
		End If	
   	End If
End Sub ’ItemDB

C#


protected void ItemDB (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
	if((e.Item.ItemType == ListItemType.Item ) || (e.Item.ItemType == ListItemType.Item ))
	{
		if( e.Item.Cells [8].Text == '0')
		{
			e.Item.Visible = false;
		}
	}
}

Share with

Share on twitter
Share on facebook
Share on linkedin