Freezing columns in a .Net Framework v4.5 GridView using.Frozen property

265 Views Asked by At

I'm trying to programmatically freeze columns in an ASP.Net GridView control with Visual Basic.

My code is taken from the msdn knowledge base at:

https://msdn.microsoft.com/en-us/library/28e9w2e1(v=vs.90).aspx

The code is:

mydatagridview.columns("manufacturer").frozen = true

The GridView has been bound with data and the columns are automatically generated, the relevant one from a data field "manufacturer".

However, I get the error message:

'Frozen' is not a member of 'System.Web.UI.WebControls.DataControlField'.

Can anyone point me in the right direction to correct this?

The .Frozen property is only available from .Net Framework v4.5 onwards. When I get the compile error the page says that the .Net Framework 4.0 is being used, though I believe that this happens even when 4.5 is actually running on the server (which is how the application pool is set up in IIS).

1

There are 1 best solutions below

0
On

I think I can answer my own question here - the datagridview is a windows form control, not a GridView. Doh! Too much late night coding.