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

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? 

Parents
No Data
Reply
  • 695
    posted

    Hello,

    if you are using BoundDataField for the columns, you should set AutoGenerateColumns to false. That's why your columns are shown twice.
    I believe you are getting the error because you're using <%=  %>. Try using  <%#  %>.

    Regards,
    Nikolai Dimitrov

Children