Click here to Skip to main content
15,919,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every body ,
i have a Data table Contains Two columns the First One Called Column1(of type string) , and the Second one called Column2(of type Boolean) , i bounded this table to Data Grid Combo Box Column , for some reasons i want to display the column1 in the data grid combo box column if the value of the column 2 is true and not display it if the value is false
is there a way o do that in XML , or code behind ,
thanks in advanced
Posted

Your best bet would be to have a separate collection which you can populate using LinQ, that stores all the positive columns of your datatable, and then bind the combo box column to this separate collection.

Hope this helps
 
Share this answer
 
Comments
Yasser El Shazly 9-Nov-11 5:39am    
For some reasons i want all positive and negative rows in one collection
You can do it in code behind by using OnItemDataBound Event of datagrid.


The data is bounded to the datagrid upon firing this event.So, get the column 2 value as
<pre lang="c#">
protected void OnItemDataBound(object sender,DataGridItemEventArgs e)
if(e.Item.Cells[1].Text==1)//column2 value is either 0 or 1 whether true or false
{
//Do Some Action To remove data from Column 1 such as 
   //e.Item.Cells[0].Text=String.Empty;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900