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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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;">
                <Store>
                    <ext:Store ID="StorePlant" runat="server" AutoLoad="true" AutoDataBind="true">
                        <Reader>
                            <ext:JsonReader Root="plants" IDProperty="PlantCode">
                                <Fields>
                                    <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" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                        <SortInfo Field="PlantCode" Direction="ASC" />
                    </ext:Store>
                </Store>
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <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:Column>
                        <ext:CommandColumn Width="30">
                            <PrepareToolbar Fn="prepareToolbar" />
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
                </SelectionModel>
                <Listeners>
                    <Command Fn="commandHandler" />    
                </Listeners>
                <LoadMask ShowMask="true" />
            </ext:GridPanel>
  2. #2

    SOLVED

    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