title: Hide/display Telerik RadGrid columns on pre-render
body: <p>I'm trying to hide/show different columns on a nested telerik rad grid in the pre-render event, based on a flag but they are all displaying regardless of what I set the visible or display property to</p>
  
  <p>These are my grid columns:</p>
  
  <pre><code>&lt;telerik:GridBoundColumn UniqueName="LocalDeanery" ReadOnly="true" DataField="localdeanery" HeaderText="Local Deanery" SortExpression="localdeanery"
      HtmlEncode="false" &gt;
  &lt;/telerik:GridBoundColumn&gt;               
  
  &lt;telerik:GridTemplateColumn UniqueName="Sector2013" HeaderText="Sector" SortExpression="hasBeenHeld desc,Sector" AllowFiltering="false" &gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Eval("Sector").ToString() + " (" + Eval("PrefRank").ToString() + ") " + (Eval("conditional").ToString()==""?"":"Conditional")%&gt;'
               Visible='&lt;%#  Eval("OfferId").ToString()!="" %&gt;' /&gt;
      &lt;/ItemTemplate&gt;
  &lt;/telerik:GridTemplateColumn&gt;
  
  &lt;telerik:GridBoundColumn UniqueName="Region" ReadOnly="true" DataField="tRegion" HeaderText="Region" SortExpression="tRegion"
      HtmlEncode="false"&gt;
  &lt;/telerik:GridBoundColumn&gt;               
  
  &lt;telerik:GridBoundColumn UniqueName="Subregion" ReadOnly="true" DataField="tSubRegion" HeaderText="Sub-Region" SortExpression="tSubRegion"
      HtmlEncode="false" &gt;
  &lt;/telerik:GridBoundColumn&gt;               
  
  &lt;telerik:GridBoundColumn UniqueName="Sector2014" ReadOnly="true" DataField="tSector" HeaderText="Sector" SortExpression="tSector"
      HtmlEncode="false" &gt;
  &lt;/telerik:GridBoundColumn&gt;
  </code></pre>
  
  <p>And this is the code to hide the columns:</p>
  
  <pre><code>protected void RadGrid1_PreRender(object sender, EventArgs e)
  {
      RadGrid od = (RadGrid)RadGrid1.MasterTableView.Items[0].ChildItem.FindControl("OfferDataDetail");
      Label ry = (Label)RadGrid1.MasterTableView.Items[0].ChildItem.FindControl("LblRoundYear");
  
      int RoundYear = 2014;
      if (ry != null) RoundYear = int.Parse(ry.Text);
  
      //display for 2013
      od.Columns.FindByUniqueName("LocalDeanery").Visible = (RoundYear == 2013);
      od.Columns.FindByUniqueName("Sector2013").Visible = (RoundYear == 2013);
      //display for 2014
      od.Columns.FindByUniqueName("Region").Visible = (RoundYear == 2014);
      od.Columns.FindByUniqueName("Subregion").Visible = (RoundYear == 2014);
      od.Columns.FindByUniqueName("Sector2014").Visible = (RoundYear == 2014);
  
      od.Rebind();
  }
  </code></pre>
  
  <p>All of these columns display even when I set the display to false, a QuickWatch on the columns will give the display value as what I expect (ie true or false) but when the page loads they are all shown in the grid.</p>
  
  <p>Any ideas anyone?</p>