Posted on 2008-10-06
How do you access and filter Gridview Data? I have a gridview (gvRecords) setup on a page that is reading data from an object datasource (objData). It currently selects all records in a data table. I want to be able to filter the records for the Gridview in the code behind like so:
protected void Page_Load(object sender, EventArgs e)
if (!User.Identity.IsAuthenticated() || !User.IsInRole("Administrator"))
//Filter Gridview to show only records marked active???
//What can I do to the gridview to apply a row filter?
GridView.RowFilter = "Active = 1";
//Or is there a way to get it from the Datasource?
objData.RowFilter = "Active = 1";