Display="false" not working on gridboundcolumn

12 posts, 1 answers
  1. Jeroen
    Jeroen avatar
    7 posts
    Member since:
    Oct 2011

    Posted 20 Jan 2012 Link to this post

    I've got a grid with 3 columns set to display=false and after updating my radcontrols to the non-trial version they appear on pageLoad even when Display="False" is set. Any ideas as to what could be the problem there?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Jan 2012 Link to this post

    Hello Joroen,

    I tried the same in this version 2011.2.915.35 which worked as expected. Please provide your code if it doesn't help.

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeroen
    Jeroen avatar
    7 posts
    Member since:
    Oct 2011

    Posted 20 Jan 2012 Link to this post

    This is what I use for the column. It was working before I upgraded to 2011.3.1305.40

    <
    telerik:GridBoundColumn
                                DataField="ORT"
                                DataFormatString="{0:C}" 
                                Aggregate="Sum"
                                DataType="System.Decimal"
                                HeaderText="ORT"
                                ReadOnly="True"
                                SortExpression="ORT"
                                FooterAggregateFormatString="{0:C}"
                                UniqueName="ORT"
                                Display="False">
  5. Jeroen
    Jeroen avatar
    7 posts
    Member since:
    Oct 2011

    Posted 20 Jan 2012 Link to this post

    I am working on a demo for monday at the moment. Do you have any ideas as to what the solution might be?
  6. Answer
    Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 20 Jan 2012 Link to this post

    Hello,

    I have created a sample project to illustrate how Display property works on our side. This project also uses Q3 2011 release of our controls.

    Give it a try and check what are the differences with your project.

    Kind regards,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  7. Imran Javed Zia
    Imran Javed  Zia avatar
    55 posts
    Member since:
    Jul 2009

    Posted 30 Jan 2012 Link to this post

    Hi,
    We having same issue with 2011.2.915.40. we have couple of columns with Display="False" in the grid and they were not visible to end client till 2011 Q1. but we are getting this issue after updating to 2011 Q2.
    Can you please provide some assistance in this regards. We will not be able to upgrade to 2011 Q3 at the meoment.
    Thanks 
  8. Imran Javed Zia
    Imran Javed  Zia avatar
    55 posts
    Member since:
    Jul 2009

    Posted 30 Jan 2012 Link to this post

    Hi Andrey,
    We have just recreated the issue with you sample too with 2011 Q3.  Although we are getting little different issue but you can check that hidden columns become visible after scrolling back. here are steps to generate issue:
    make sure horizental scrolbar is visible.
    Make first few columns fixed.
    now scrol the grid to right and back to left. "ContactName" becomes visible.

    But we are having issue that hidden columns are visible on permanent bases in our application, we have fixed as well as static as well as dynamically added columns.

    for testing just change aspx as following:
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" CellSpacing="0"
                 OnItemDataBound="RadGrid1_ItemDataBound">
                <MasterTableView AutoGenerateColumns="False" DataKeyNames="CustomerID"
                    EditMode="EditForms">
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn1">
                        </telerik:GridEditCommandColumn>
                         
                        <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True"
                            SortExpression="CustomerID" UniqueName="CustomerID" Display="True">
                        </telerik:GridBoundColumn>
                         
                        <telerik:GridBoundColumn DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName"
                            UniqueName="ContactName" Display="false">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
     
     
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle"
                            UniqueName="ContactTitle">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                         
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 1" SortExpression="ContactTitle"
                            UniqueName="ContactTitle1">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 2" SortExpression="ContactTitle"
                            UniqueName="ContactTitle2">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 3" SortExpression="ContactTitle"
                            UniqueName="ContactTitle3">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 4" SortExpression="ContactTitle"
                            UniqueName="ContactTitle4">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
     
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 5" SortExpression="ContactTitle"
                            UniqueName="ContactTitle5">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 6" SortExpression="ContactTitle"
                            UniqueName="ContactTitle6">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
     
     
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 7" SortExpression="ContactTitle"
                            UniqueName="ContactTitle7">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 8" SortExpression="ContactTitle"
                            UniqueName="ContactTitle8">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 9" SortExpression="ContactTitle"
                            UniqueName="ContactTitle9">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 10" SortExpression="ContactTitle"
                            UniqueName="ContactTitle10">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 11" SortExpression="ContactTitle"
                            UniqueName="ContactTitle11">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                         
                         
                         
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle 12" SortExpression="ContactTitle"
                            UniqueName="ContactTitle12" Display="false">
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
     
                        <telerik:GridDropDownColumn UniqueName="DropDownColumn1" HeaderText="cbo" DropDownControlType="RadComboBox">                   
                            <HeaderStyle Width="150px" Wrap="false" />
                            <ItemStyle Width="150px" />
                        </telerik:GridDropDownColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings EnablePostBackOnRowClick="false" EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="True" />
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="100%"
                        FrozenColumnsCount="2" />
                    <ClientEvents  />
                    <Resizing AllowColumnResize="true" />
                </ClientSettings>
                <SortingSettings EnableSkinSortStyles="false" />
                <FilterMenu EnableEmbeddedSkins="False" Skin="Grid">
                    <CollapseAnimation Duration="200" Type="OutQuint" />
                </FilterMenu>
                <PagerStyle AlwaysVisible="true" Height="25px" Width="100%" Mode="NumericPages" />
            </telerik:RadGrid>

     


    Thanks
  9. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 30 Jan 2012 Link to this post

    Hello,

    Hiding columns when FrozenColumns feature is enabled is not supported scenario. You could check this help topic(Unsupported scenario section) for more information about this limitation.

    All the best,
    Andrey
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  10. Bruce
    Bruce avatar
    4 posts
    Member since:
    Jun 2010

    Posted 21 Apr 2014 Link to this post

    This is driving me mad!   What is the point of Display=false?  When I set Display=false, the column still displays when the use Adds or Edits a row. 

    I have a page with multiple related grids.  The column I am trying to hide is a foreign key on a child grid.  The user should not have to see or be able to modify this value.  This seems so fundamental.  I need to invisibly insert the foreign key and update the row that contains the foreign key without showing the foreign key.

    The gridboundcolumn property that I need, but which is missing is, style="display:none"  




  11. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Apr 2014 in reply to Bruce Link to this post

    Hi Bruce,

    If you set Display="false", the column will be hidden only in view mode. If you want to hide the column in edit/insert mode you should set ReadOnly="true" for the BoundColumn.

    ASPX:
    <telerik:GridBoundColumn UniqueName="ID" DataField="ID" Display="false" ReadOnly="true">                     
    </telerik:GridBoundColumn>

    Thanks,
    Princy
  12. Bruce
    Bruce avatar
    4 posts
    Member since:
    Jun 2010

    Posted 21 Apr 2014 in reply to Princy Link to this post

    Thanks for the reply.  When I set Display=false, and ReadOnly=true, and then update a record via the grid, the foreign key gets inserted as NULL.  That's my issue.  So to restate my problem: The InsertCommand does not get access to the foreign key value and the foreign key column is inserted as NULL.



  13. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Apr 2014 in reply to Bruce Link to this post

    Hi Bruce,

    You can access the column in insert mode and set some value to it so that it is not entered as null.

    C#:
    protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
    {
      GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;    
      (insertedItem["Id"].Controls[0] as TextBox).Text="Some Value";// set value for foreign key
      string id = (insertedItem["Id"].Controls[0] as TextBox).Text;// get the text in a string
      //store this id to db
    }

    Thanks,
    Princy
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017