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

Grid column widths (cut off)

7 Answers 568 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike Causi
Top achievements
Rank 1
Mike Causi asked on 13 Sep 2010, 07:07 PM
What I am finding is that if I define the width on one column of the grid like this:

<

 

rada:GridBoundColumn DataField="AccountNo" Visible="true" HeaderText="AccountNo" HeaderStyle-Width=500 ItemStyle-Width=500 FooterStyle-Width=500

 

 

HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" SortExpression="UserAccountAddress.AccountNo">

 

 

</rada:GridBoundColumn>

 



Then, every other column gets cut/shrunk losing the text.  What I feel that it should do, is, if it can't fit everything in based on my window size, is add a horrizontal scroll bar to the grid (using static headers as well in case that makes a difference). (see uploaded image).  Is there a way to tell the other columns to expand as needed?

 

<rada:RadGrid ID="rg" runat="server" AllowSorting="True" AllowMultiRowSelection="true" AutoGenerateColumns="false"

 

 

Width="96%" OnNeedDataSource="rg_NeedDataSource" Height="230">

 

 

 

<MasterTableView Width="100%" Summary="RadGrid table" DataMember="Documents" CommandItemDisplay="Top"

 

 

 

 

 

CommandItemSettings-ShowExportToExcelButton="true" CommandItemSettings-ShowExportToCsvButton="false" ShowHeadersWhenNoRecords="true"

 

 

 

 

 

AllowNaturalSort="false">

 

 

 

 

 

<Columns>

 

</

 

MasterTableView>

 

 

 

 

 

<ClientSettings>

 

 

 

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>

 

 

 

 

 

<Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" EnableDragToSelectRows="false" />

 

 

 

 

 

</ClientSettings>

 

 

 

 

 

</rada:RadGrid>

 

7 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 14 Sep 2010, 08:19 AM
Hi Mike,

Please have in mind that it is not recommended to use ItemStyle-Width to set column widths. Only HeaderStyle-Width should be used. You can refer to the forum thread below for more information about
Best Practice for Grid and Column widths.

I hope this helps

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mike Causi
Top achievements
Rank 1
answered on 14 Sep 2010, 01:37 PM
So, I tried with just the header width set.  Still the same problem.  The column I defined the width on looks ok, but the rest of the columns clip when I shrink the window size down. 

What I don't understand is why when I have static headers on, the columns won't shrink down when the window size shrinks.  It will however, expand the columns when I grow the window size.  With static headers off it works both ways. 

My problem is, there is an abundant of whitespace between columns and way too much padding.  I don't understand why the columns don't wrap the text instead of clipping it when I resize the window.

Please help.  It is creating way too much horizontal scrolling.  And, setting the widths on each column doesn't make sense since the column data is very dynamic in length.
0
Mike Causi
Top achievements
Rank 1
answered on 14 Sep 2010, 02:05 PM
In addtion, I don't understand how it decides how wide a column should be.  I have one column that is twice as wide as it needs (when I don't define any widths on the columns at all).  I cannot get it to shrink down without setting the column width in pixels (which as I mentioned above will eventually just clip all of the other columns).
0
Pavlina
Telerik team
answered on 15 Sep 2010, 02:08 PM
Hi Mike,

If the RadGrid resizes together with its parent and you are using static headers, then either set pixel widths to all columns (fixed table layout), or do not set any column widths at all (auto layout). However, I am sending you a simple working project that demonstrates the desired functionality. Give it a try and let me know how it goes.

Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Caleb
Top achievements
Rank 1
answered on 24 May 2012, 04:03 PM
I tried looking at the project you submitted but I am getting inconsistent results with the project. Sometimes when the window is re-sized the headers will snap back to place. Other times they will be unaligned with their associated columns.

 
0
Pavlina
Telerik team
answered on 24 May 2012, 05:28 PM
Hi,

Can you specify which version of RadControls you are using and in which browser you are testing the project? This problem should not persist with the latest version of RadControls for ASP.NET AJAX.

All the best,
Pavlina
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
Gary
Top achievements
Rank 1
answered on 02 May 2013, 02:32 PM
I have found the same thing.  How I got rid of it was to remove my grid from the table I had it in and place it in a DIV on the page.
I'm always at the current release of the controls.
That's my only problem so far with the grid.  We love it here.

Hope this helps.
Tags
Grid
Asked by
Mike Causi
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Mike Causi
Top achievements
Rank 1
Caleb
Top achievements
Rank 1
Gary
Top achievements
Rank 1
Share this question
or