Hide Specific Auto-Generated Columns

4 posts, 0 answers
  1. bslaght
    bslaght avatar
    184 posts
    Member since:
    Jun 2006

    Posted 08 Jul 2008 Link to this post

    I am auto-generating my columns, however I want to hide the "ID" column.  Can this be done without specifically defining the column ?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Jul 2008 Link to this post

    Hi,

    You can hide the AutoGeneratedColumns in the ColumnCreated event as shown below.

    CS:
     protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) 
        { 
            if (e.Column is GridBoundColumn) 
            { 
                GridBoundColumn col = (GridBoundColumn)e.Column; 
                if (col.UniqueName == "ID") 
                { 
                    col.Visible = false
                } 
            } 
        } 


    Thanks
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. bslaght
    bslaght avatar
    184 posts
    Member since:
    Jun 2006

    Posted 09 Jul 2008 Link to this post

    Thanks Shinu, works great!
  5. Liza
    Liza avatar
    10 posts
    Member since:
    Dec 2008

    Posted 19 Jan 2009 Link to this post

    Hi!! I hope you can help me!!
    I was trying to do what you said before but, I always got the same error:

    Error de servidor en la aplicación '/GP'.

    Colección modificada; puede que no se ejecute la operación deenumeración.

    Descripción:Excepción no controlada al ejecutar la solicitud Web actual. Revise elseguimiento de la pila para obtener más información acerca del error y dónde seoriginó en el código.

    Detalles de la excepción:System.InvalidOperationException: Colección modificada; puede que no seejecute la operación de enumeración.

    Error de código fuente:

    Se ha generado una excepción no controlada durante la ejecución de la solicitud Web actual. La información sobre el origen y la ubicación de la excepción pueden identificarse utilizando la excepción del seguimiento de la pila siguiente.

    Seguimiento de lapila:

    [InvalidOperationException: Colección modificada; puede que no se ejecute la operación de enumeración.]  
    System.Web.UI.ControlCollectionEnumerator.MoveNext() +8648494   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +143  
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +10   
    Telerik.Web.UI.RadCompositeDataBoundControl.RenderContents(HtmlTextWriter writer) +46   
    Telerik.Web.UI.RadGrid.RenderContents(HtmlTextWriter writer) +56   
    Telerik.Web.UI.RadGrid.Render(HtmlTextWriter writer) +174   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    Telerik.Web.UI.ControlRenderer.Render(HtmlTextWriter writer) +84   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27  
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) +238   
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10   
    System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) +35   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    Telerik.Web.UI.PreControlToAjaxify.Render(HtmlTextWriter writer) +112   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    Telerik.Web.UI.ControlRenderer.Render(HtmlTextWriter writer) +84   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) +238   
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10   
    System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) +35   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    Telerik.Web.UI.PreControlToAjaxify.Render(HtmlTextWriter writer) +112   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163   
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32   
    System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.Control.Render(HtmlTextWriter writer) +10   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.Page.Render(HtmlTextWriter writer) +29   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +640   
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256   
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19   
    System.Web.UI.Page.Render(HtmlTextWriter writer) +29   
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99   
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25   
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266
                


    Información de versión: Versión de Microsoft .NETFramework:2.0.50727.3053; Versión ASP.NET:2.0.50727.3053 



    thanks!!
Back to Top