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

Column Width when no data is present

6 Answers 223 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dburgett
Top achievements
Rank 1
dburgett asked on 13 Oct 2008, 01:30 AM
This seems like such a simple problem, I'm surprised that I can't figure it out myself or find an answer on the forums.

I have a RadGrid (for ASP.Net AJAX) with a specified width. There are three columns, one of which is hidden or displayed based on the data.  When there is data, the columns nicely fill the specified width of the grid, regardless of the number of columns displayed. (That is, if all 3 are shown, then their collective width = the grid width. When the first column is hidden, the other columns expand in order to still fill the entire grid width.)

The problem occurs when there are no records to display. In this case, the column widths are the minimum width necessary to fit the HeaderText for each column. This leaves a big ugly gap to the right of the last column.

I have MasterTableView / TableLayout set to "Auto" and no specific width on the last column.

Is there a property I can set on the grid or column to make it fill the available width even when there is no data present?

thx,
david

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Oct 2008, 09:19 AM
Hi David,

If you are using scrolling with static headers, the master table's layout is "auto" and there are no column widths specified, the columns will shrink to fill the minimum required space - this is expected.

In order to avoid this, please either set column widths, or set TableLayout="Fixed", or set Width="95%" for the MasterTable.

Let us know if you need more information.

Best wishes,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
dburgett
Top achievements
Rank 1
answered on 15 Oct 2008, 04:35 AM
Thanks, Dimo.

TableLayout="Fixed" was exactly what I needed!  The columns now fill the table regardless of the number of columns or presence of data.

(Setting the MasterTableView Width=100% worked as well.)

0
Shiva
Top achievements
Rank 1
answered on 16 Mar 2009, 12:26 PM
Hello sir,
      I am new to this field and to this site. I have seen many forums which have really helped me to solve most of the problems, but for this i want to try sending a post and get used to it asking help from all of you sir/mam.
      I have a same kind of problem when there is no data but the problem is little different. I don't know were to check to rectify the error.
I have a RadGrid.ASP.NET.AJAX Q3 version. I am creating a Dynamic columns which has 16 columns. When the grid has rows i am able to view all the 16 columns, but the problem is when there is no rows. The look and feel of the table has no problem.
         I will make u more clear, i have a scrolling on x-axis in the MasterTable. When i scroll the table with rows in it i am able to view all the 16 columns, but when i scroll the table with no Rows in it i am not able to view the last four columns, but if i manually resize any one of the column when there is no rows and if i scroll i am able to view 16 columns. Can u please help me to solve this error.
 
0
Sebastian
Telerik team
answered on 16 Mar 2009, 12:32 PM
Hi Shiva,

Can you please check whether the same issue appears if you set TableLayout = fixed for your grid (the default value is auto)? Additionally, you can test with the latest official release Q1 2009 (2009.1.311) of the product to see whether the problem occurs in this version.

If so, isolate a stripped working version of your project and send it enclosed to a formal support ticket. We will test/debug it locally and will get around to you with more info on the subject.

Best regards,
Sebastian
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Shiva
Top achievements
Rank 1
answered on 16 Mar 2009, 12:50 PM
Hello sir,
     I first Thank you for the reply. I tried using the property TableLayout="Fixed" in grid but there is no change. I have a fixed column width in the dynamic column coding in C#. I have pasted the XML coding of the page below sir.

<telerik:RadGrid ID="RecordingRadGrid" runat="server" SkinID="ContentGrid"
    AllowPaging="True" PageSize="50" TableLayout="Fixed" OnNeedDataSource="RecordingRadGrid_NeedDataSource"
    AutoGenerateColumns="False"  OnItemDataBound="RecordingRadGrid_ItemDataBound" OnPageIndexChanged="RecordingRadGrid_PageIndexChanged" meta:resourcekey="RecordingRadGridResource1">
    <PagerStyle  AlwaysVisible="True" Mode="NextPrevAndNumeric" />
    <MasterTableView AllowNaturalSort="False">
        <ExpandCollapseColumn Visible="False">
            <HeaderStyle Width="19px" />
        </ExpandCollapseColumn>
        <RowIndicatorColumn Visible="False">
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
    </MasterTableView>
    <ClientSettings >
        <Selecting AllowRowSelect="True"></Selecting>
        <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>        
        <Resizing AllowColumnResize="True" />      
    </ClientSettings>
</telerik:RadGrid>
 
Can you help me please  to solve this problem in server side coding using C# language.

0
Sebastian
Telerik team
answered on 19 Mar 2009, 11:55 AM
Hello Shiva,

To progress in our investigation,  I suggest you isolate a working test page and send it enclosed to a formal support ticket. I will examine your complete implementation in detail and will get back to you with my findings.

Best regards,
Sebastian
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
dburgett
Top achievements
Rank 1
Answers by
Dimo
Telerik team
dburgett
Top achievements
Rank 1
Shiva
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or