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
Hide columns when AutoGenerateColumns is True

Is there a way to hide columns in server side using AutoGenerateColumns as True?

If I use a BoundDataField for the columns I want to hide and those columns are shown twice and when I set the property Hide to True I got the following error:

'The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). '

Even when I hide a column with js I got the same error.

What can I do?