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

auto fit based on grid contents

3 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kip
Top achievements
Rank 1
Kip asked on 16 Dec 2009, 11:53 PM
With DevExpress, when I drop a gridview control into a page with no width setting the grid will size itself according to header/row contents.

With Telerik, the gridview with no width property configured will expand to 100% of the width of the container it's in. I do not want to configure the width. I looked through several forum posts here and was unable to find a solution. Although I did attempt to change several settings while searching for a solution, this happens with all properties set to their default values.

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 17 Dec 2009, 03:03 PM
Hi Kip,

Indeed, RadGrid expands itself to 100% by default, because its wrapper element is a <div> and not a <table>. Here is how to make the control shrink, according to its content:

http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-defaults-to-100-wide.aspx


Kind regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kip
Top achievements
Rank 1
answered on 17 Dec 2009, 04:39 PM
Dimo,
Thanks... That solution works great. The main reason I use these controls is due to my lack of experience with the web piece... allows rapid development for native programmers.

One question, when using the css fix if I enable the scrolling option the control again expands to 100% width, how would I make it auto fit based on the contents with scrolling enabled? I'm really looking for a way to make this the default behavior... I don't want it expanding to 100% unless I specifically set the width property to 100%.
0
Dimo
Telerik team
answered on 17 Dec 2009, 04:53 PM
Hello Kip,

The concept of scrolling in CSS is tightly connected to some fixed size. Scrolling with auto-fitting content does not make much sense. Scrolling occurs when a child element is larger than its scrollable container. If the latter has no explicit dimensions, how will the browser determine how large the scrollable container should be?


Best wishes,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Kip
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Kip
Top achievements
Rank 1
Share this question
or