This is a migrated thread and some comments may be shown as answers.

Display="false" not working on gridboundcolumn

11 Answers 606 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeroen
Top achievements
Rank 1
Jeroen asked on 20 Jan 2012, 12:22 PM
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?

11 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Jan 2012, 12:46 PM
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.
0
Jeroen
Top achievements
Rank 1
answered on 20 Jan 2012, 12:49 PM
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">
0
Jeroen
Top achievements
Rank 1
answered on 20 Jan 2012, 01:51 PM
I am working on a demo for monday at the moment. Do you have any ideas as to what the solution might be?
0
Accepted
Andrey
Telerik team
answered on 20 Jan 2012, 04:30 PM
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
0
Imran Javed Zia
Top achievements
Rank 1
answered on 30 Jan 2012, 10:23 AM
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 
0
Imran Javed Zia
Top achievements
Rank 1
answered on 30 Jan 2012, 11:49 AM
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
0
Andrey
Telerik team
answered on 30 Jan 2012, 02:01 PM
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
0
Bruce
Top achievements
Rank 1
answered on 21 Apr 2014, 10:01 PM
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"  




0
Princy
Top achievements
Rank 2
answered on 22 Apr 2014, 03:21 AM
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
0
Bruce
Top achievements
Rank 1
answered on 22 Apr 2014, 04:10 AM
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.



0
Princy
Top achievements
Rank 2
answered on 23 Apr 2014, 06:22 AM
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
Tags
Grid
Asked by
Jeroen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jeroen
Top achievements
Rank 1
Andrey
Telerik team
Imran Javed Zia
Top achievements
Rank 1
Bruce
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or