How to Hide & Show a CommandColumn in a Grid ??

  1. #1

    How to Hide & Show a CommandColumn in a Grid ??

    I have the Client & Admin, I ONLY want to show the Command Column base on their Windows NT login.

    How would I go about doing that, because there is no ID or runat="server" on the "CommandColumn" ??

            <ext:GridPanel ID="GridPanelPlants" runat="server" StripeRows="true" Title="Existing Plants"
                TrackMouseOver="true" Icon="BuildingGo" Height="140" Width="575" AutoExpandColumn="PlantName"
                StyleSpec="margin-left: 20px; margin-top: 20px;">
                    <ext:Store ID="StorePlant" runat="server" AutoLoad="true" AutoDataBind="true">
                            <ext:JsonReader Root="plants" IDProperty="PlantCode">
                                    <ext:RecordField Name="PlantCode" Type="String" />
                                    <ext:RecordField Name="PlantName" Type="String" />
                                    <ext:RecordField Name="DateStartRun" Type="Date" />
                                    <ext:RecordField Name="DateEndRun" Type="String" />
                                    <ext:RecordField Name="IsActive" Type="Boolean" />
                        <SortInfo Field="PlantCode" Direction="ASC" />
                <ColumnModel ID="ColumnModel1" runat="server">
                        <ext:Column ColumnID="PlantCode" Header="Plant Code" DataIndex="PlantCode" />
                        <ext:Column Header="Plant Name" DataIndex="PlantName" />
                        <ext:DateColumn Header="Start Date" DataIndex="DateStartRun" Format="MM-dd-yyyy" />
                        <ext:DateColumn Header="End Date" DataIndex="DateEndRun" Format="MM-dd-yyyy" />
                        <ext:Column Header="Is Active" DataIndex="IsActive">
                            <Renderer Fn="formatStatus" />
                        <ext:CommandColumn Width="30">
                            <PrepareToolbar Fn="prepareToolbar" />
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
                    <Command Fn="commandHandler" />    
                <LoadMask ShowMask="true" />
  2. #2


    if (Session["IsAdmin"].ToString().AsBool())
    GridPanelPlants.ColumnModel.Columns[5].Hidden = true;

Similar Threads

  1. [CLOSED] [1.0] Hide GridCommand in CommandColumn
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 10, 2011, 10:13 AM
  2. Replies: 0
    Last Post: Mar 03, 2011, 1:08 PM
  3. [CLOSED] Show Hide Grid Panel from runtime
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 23, 2011, 6:32 PM
  4. [CLOSED] Show/Hide grid columns
    By GmServizi in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Mar 28, 2010, 6:39 AM
  5. Replies: 2
    Last Post: Mar 04, 2009, 4:28 PM

Posting Permissions