Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello,

I have display 3 column in datagridview name Id,Name,Address. Now I have problem that i want to id column hide in datagridview

I was using this type Error was Less then size of colletion Parameter index
what is code in wpf window c# hide column


grdFillEmploye.Columns[0].Visibility =Visibility.Hidden; //ID

grdEmployeDetail.Columns["EmailAddress"].HeaderText = "Email_ID";//Allso change Column Header text Name
Posted
Updated 13-Oct-20 22:59pm

try like this :

grdFillEmploye.Columns[0].Visibility = "false";

pls see here :

http://stackoverflow.com/questions/5376278/how-to-hide-a-column-gridview-but-still-access-its-value[^]
 
Share this answer
 
You have answer in question.

if(grdFillEmploye.Columns.Count>0)
grdFillEmploye.Columns["ID"].Visibility =Visibility.Hidden;

If it not works try this
if(grdFillEmploye.Columns.Count>0)
grdFillEmploye.Columns[0].Visible =false;
 
Share this answer
 
Comments
Member 8847418 1-Aug-12 8:36am    
Not to be acept ["ID"]
if(grdFillEmploye.Columns.Count>0)
grdFillEmploye.Columns["ID"].Visibility =Visibility.Hidden;
pradiprenushe 1-Aug-12 8:45am    
then try second one
if(grdFillEmploye.Columns.Count>0)
grdFillEmploye.Columns[0].Visible =false;

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