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

Grid header CSS problem after "Best Fit"...

3 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
FISCAL
Top achievements
Rank 1
FISCAL asked on 07 Jun 2011, 11:08 AM
Hi,

I am having a problem with HeaderStyle cssclass after the grid has been resized using "best fit" feature. To show the problem, please have a look on the colour of the header in Error.PNG. Ideally I want to have it look like it was before applying "best fit" shown as in "original.png".

Following is javascript is responsible for resizing the grid during page load event.

function pageLoad() {
            var grid = $find("<%= grid.ClientID %>");
            var columns = grid.get_masterTableView().get_columns();
            for (var i = 0; i < columns.length; i++) {
                columns[i].resizeToFit();
            }
        }

Many thanks.
MG

3 Answers, 1 is accepted

Sort by
0
Galin
Telerik team
answered on 10 Jun 2011, 08:31 AM
Hello Milan,

Thank you for contacting us.

For using method columns[i].resizeToFit() you have to enable AllowColumnResize and AllowResizeToFit like in the next example:
<ClientSettings>
    <Resizing AllowColumnResize="true" AllowResizeToFit="true" />
</ClientSettings>

Please refer to this help topic.

I hope this help. Let me know if I can assist you any further.

Best wishes,
Galin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
FISCAL
Top achievements
Rank 1
answered on 10 Jun 2011, 08:40 AM
Hi Galin,

My apologies. 'Best Fit' works perfectly. It's just that the custom css not applied properly after "Best Fit". Please refer to Original.png and Error.png.

"Original.png" has proper header colour and once "Best Fit" is applied, the grid looks like in "Error.png". How can I make it look correct?

Many thanks.
MG
0
Galin
Telerik team
answered on 10 Jun 2011, 01:47 PM
Hello Milan,

You see the background of the headers, because in this case the RadGrid covers bigger place than the width of all columns. Set ClientSettings-Resizing-ResizeGridOnColumnResize="true"  to allow the RadGrid resize as necessary. Also to avoid conflict do not allow scroll for the Grid (ClientSettings-Scrolling-AllowScroll="false")

Additionally, please refer tothis demo site.

Kind regards,
Galin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
FISCAL
Top achievements
Rank 1
Answers by
Galin
Telerik team
FISCAL
Top achievements
Rank 1
Share this question
or