hi , iam trying to hide auto generated columns in the webdatagrid using but this won't work :
WebDataGrid1.DataSource = dt; WebDataGrid1.DataBind();
this.WebDataGrid1.Rows[0].Items[0].Column.Hidden = true; this.WebDataGrid1.Rows[0].Items[1].Column.Hidden = true;
iam doing something wrong ? please help.
Hi,
When the columns are auto generated you can hide a column form the InitializeRow event.
For example:
protected void Page_Load(object sender, EventArgs e) { this.WebDataGrid1.DataSource = dt; this.WebDataGrid1.DataBind(); } protected void WebDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e) { if(e.Row.Index == 0) { e.Row.Items[0].Column.Hidden = true; e.Row.Items[1].Column.Hidden = true; } }
hi , i already tried that too and it didn't work !
I am sending you a sample where the columns are autogenerated and hide them in the OnInitializeRow event.
Can you look at it and see if the problem is reproducible there.WDGHideColumn.zip