get value of hidden column with command onevent

  1. #1

    get value of hidden column with command onevent

    Hello I have a hidden column batchid, next to it is a commandcolumn with a button.
    Upon click I want to show the value of the cell (in column batchid same row).

    This is what I have, it won't even show on the screen.

    test.aspx
        <ext:GridPanel ID="grid" runat="server" Title="" AutoWidth="true" AutoHeight="true"
            Padding="4" StripeRows="true" Draggable="false" Selectable="true">
            <Store>
                <ext:Store ID="Store1" runat="server" WarningOnDirty="false">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="batchid" Mapping="batchid" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                    <ext:Column DataIndex="batchid" Header="BatchID" Width="100" Hidden="true">
                    </ext:Column>
                    <ext:CommandColumn>
                        <Commands>
                            <ext:GridCommand Icon="Cancel" CommandName="Cancel" Text="Cancel" Hidden="true">
                            </ext:GridCommand>
                        </Commands>
                    </ext:CommandColumn>
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="false" />
            </SelectionModel>
            <DirectEvents>
                <Command OnEvent="btnCancel">
                  <ExtraParams>
                  <%-- get value batchid --%>
                        <ext:Parameter Name="batchid" Value="function(record){return record.get('batchid).value;}" Mode="Raw">
                        </ext:Parameter>
                    </ExtraParams>
                </Command>
            </DirectEvents>
        </ext:GridPanel>
    test.aspx.cs
    [DirectMethod]
            protected void btnCancel(Object sender, DirectEventArgs e)
            {
               // show the value
                string test = e.ExtraParams["batchid"];
                ExtNet.MessageBox.Show(new MessageBoxConfig
                    {
                        Buttons = MessageBox.Button.OK,
                        Icon = MessageBox.Icon.ERROR,
                        Title = "Test",
                        Message = test
                    });
            }
  2. #2
    Value="record.data.batchid"
    Does someone happen to know how to turn off/on the commandcolumn (in code behind)? I can't seem to approach it, something like
    grid.ColumnModel1.commandcolumn.Visible = true/false;
    If not needed I don't when to show my button cancel
    Last edited by Daniil; Mar 20, 2012 at 4:42 PM. Reason: Please use [CODE] tags
  3. #3
    Found it:
    grid.ColumnModel.SetHidden(9, true);
    Last edited by Daniil; Mar 20, 2012 at 4:42 PM. Reason: Please use [CODE] tags

Similar Threads

  1. [CLOSED] Command Column
    By RCM in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 16, 2012, 4:43 AM
  2. [CLOSED] Disable command column
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 07, 2011, 3:33 PM
  3. Add command column in gridpanel
    By tmducit in forum 1.x Help
    Replies: 1
    Last Post: May 27, 2011, 11:27 AM
  4. GridPanel Column Command?
    By peter.campbell in forum 1.x Help
    Replies: 1
    Last Post: Apr 08, 2011, 9:13 AM
  5. command column messing up grid column
    By wp_joju in forum 1.x Help
    Replies: 2
    Last Post: Dec 08, 2010, 6:40 AM

Tags for this Thread

Posting Permissions