Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1825
Hide Column with datasource assigned at runtime (columns.count always 0)
posted

Hi There!

I am assigning a dataset at runtime to a webgrid's datasource (in designer the datasource is blank).

 

 

 

 

Me.WebDataGrid1.DataSource = DS
Me.WebDataGrid1.DataMember = "orders"
Me.WebDataGrid1.DataBind()

Grid shows correctly, no problem.

Now I want to hide two columns, but the me.Webdatagrid.Columns.Count is always 0.
I tried with AutoGenerateColums set to True, set to False no way to get the columns in the collection.
The .rows.count property shows the exact numbers of rows,

So I can't hide a columns because

Me.WebDataGrid1.Columns.FromKey("GUID").Hidden = True

 

returns an error becaus the columns could'nt be founded.

 

Any idea?