Como remover registros do datagrid no asp.net se a condição satisfizer
Eu tenho um declaragrid declarar como este no arquivo ascx:
<asp:datagrid id="dgCompanies" Width="100%" AllowSorting="True" DataKeyField="companyId" AutoGenerateColumns="False"
AllowPaging="True" AllowCustomPaging="True" OnPageIndexChanged="dgCompanies_Paging" Runat="server" onprerender="dgCompanies_PreRender" >
basicamente, datagrid é o resultado da pesquisa de alguma forma semelhante a esse código:
// retrieve the matching company records
IDataReader rdr = Syntegra.Manufacturing.WMCCM.Companies.Companies.ListCompanies(dgCompanies.CurrentPageIndex, pageSize, CompanyList, CompanyNameStartsWith, ProcessSqlClause, SkillSqlClause, LocationClause, KeywordSqlClause, User, Status, SearchPortalId, false, sortColumn, sortDirection);
// highlight the sorted column
highlightSortColumn();
if (rdr.Read())
{
// calculate page details
_count = (int) rdr["companyCount"];
this.dgCompanies.VirtualItemCount = _count;
// move onto the next resultset
rdr.NextResult();
// bind the data to the datagrid
dgCompanies.PageSize = pageSize;
dgCompanies.DataSource = rdr;
dgCompanies.DataBind();
Vou precisar verificar se companyId não é igual a alguns valores, então preciso remover esse registro do resultado da pesquisa, ou seja, removê-lo do datagrid dgCompanies. Eu realmente não tenho idéia de que eu poderia fazer isso, alguém poderia me ajudar aqui?