Ankush Dubey
Ankush Dubey

Reputation: 827

Showing specific rows using GridView.RowDataBound Event

Problem

I have a Gridview bounded to a project table having one of the attribute as clientid and other attributes. Now i want to show only specific rows where clientid is equals to a given id.

What I have got

  1. Change GridView row color based on condition

2.http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx

Every example seems to update the row values but none is trying what i'm trying to do.

Second option would be creating another data table and insert all the rows which satisfy the condition and bound my grid view to that table.

I'm wondering if this could be done using rowdatabound event.

Any help would be appreciated.Thanks!!

Upvotes: 3

Views: 1618

Answers (1)

Amit Singh
Amit Singh

Reputation: 8109

You Can Try Like this

if (e.Row.RowType == DataControlRowType.DataRow)
{
if(check ur cobdition if condition is false)
e.Row.Visible=false;

}

Upvotes: 1

Related Questions