function pageLoad() { var grid = $find("RadGrid1"); var columns = grid.get_masterTableView().get_columns(); for (var i = 0; i < columns.length; i++) { columns[i].resizeToFit(); } }I wanted to set the columns sizes on the client programmatically. The above code found on the forum works great. However, I have a case where one of my columns sometimes has data that might cause some incredibly large width (say > 1000 px). Is there some way to put a max column width? I've debug inspected the columns[i] in the loop hoping to see a width property or method and then reset it if is over my desired max value.
Thanks for your help.
5 Answers, 1 is accepted
0
Hello Denis,
Thank you for contacting us.
If you want to set initial width for some Grid column, you could set its HeaderStyle-Widht server side property to the respective value.
Still this column could be resized on the client, with use of the resizeColumn() function if you want to change its width and do to make it fit.
You could check in the for loop if the current column unique name matches the unique name of the column you do not wish to resize to fit and skip it. Otherwise call the
Let me know if I can assist you any further.
All the best,
Andrey
the Telerik team
Thank you for contacting us.
If you want to set initial width for some Grid column, you could set its HeaderStyle-Widht server side property to the respective value.
Still this column could be resized on the client, with use of the resizeColumn() function if you want to change its width and do to make it fit.
You could check in the for loop if the current column unique name matches the unique name of the column you do not wish to resize to fit and skip it. Otherwise call the
resizeToFit() function. And in the else statement you could set the width of the column using the resizeColumn() function.This could be done with the following code snippet:function pageLoad() { var grid = $find("<%= RadGrid1.ClientID %>");var columns = grid.get_masterTableView().get_columns();for (var i = 0; i < columns.length; i++) {if (columns[i].get_uniqueName() != "Name") {columns[i].resizeToFit();}else {columns[i].columnResize(i, 200);}}}Let me know if I can assist you any further.
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
Bala
Top achievements
Rank 1
answered on 24 Dec 2013, 07:23 AM
Hi Andrey,
I doesn't find any method what you have specified like resizeColumn() and columnResize(). It throws me an error like "Object doesn't support this property or method". I've debugged the JS code and was searching manullay for these two methods using your code, but i can't. Please suggest me what is the other way to invoke the method.
I use Telerik.UI.dll, Telerik.UI.Skins.dll, Telerik.Web.Design.dll and the file version for all three is:2012.2.724.40
I doesn't find any method what you have specified like resizeColumn() and columnResize(). It throws me an error like "Object doesn't support this property or method". I've debugged the JS code and was searching manullay for these two methods using your code, but i can't. Please suggest me what is the other way to invoke the method.
I use Telerik.UI.dll, Telerik.UI.Skins.dll, Telerik.Web.Design.dll and the file version for all three is:2012.2.724.40
0
Hi Bala,
I have already replied to your query in the following thread:
http://www.telerik.com/community/forums/aspnet-ajax/grid/programmatically-resize-all-columns.aspx
I suggest that we continue our conversation on the mentioned thread to enable other developers with similar issues to track the discussion more easily.
Regards,
Eyup
Telerik
I have already replied to your query in the following thread:
http://www.telerik.com/community/forums/aspnet-ajax/grid/programmatically-resize-all-columns.aspx
I suggest that we continue our conversation on the mentioned thread to enable other developers with similar issues to track the discussion more easily.
Regards,
Eyup
Telerik
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 the blog feed now.
0
Naveen Kumar
Top achievements
Rank 1
answered on 11 Jul 2014, 08:46 AM
Hi Guys
Any idea on whats the size of the memory/data a RadGrid can support/handle , is there any maximum limit on collection size ?
or is it dependent on the worker process memory allocation size [which is dependent on the RAM used] ?
Thanks
Naveen
Any idea on whats the size of the memory/data a RadGrid can support/handle , is there any maximum limit on collection size ?
or is it dependent on the worker process memory allocation size [which is dependent on the RAM used] ?
Thanks
Naveen
0
Shinu
Top achievements
Rank 2
answered on 11 Jul 2014, 09:33 AM
Hi Naveen Kumar,
​Generally, there are no restrictions related to the limit of records RadGrid can support, given that you are not reaching the limits of your hardware (e.g. memory). You should also keep in mind that too many records in a page will make the page load slowly and the RadGrid control may not be very usable for the end user.
If you need to show a very large set of records, then the recommended approach is to use Virtual Scrolling and Custom Paging.
Thanks,
Shinu
​Generally, there are no restrictions related to the limit of records RadGrid can support, given that you are not reaching the limits of your hardware (e.g. memory). You should also keep in mind that too many records in a page will make the page load slowly and the RadGrid control may not be very usable for the end user.
If you need to show a very large set of records, then the recommended approach is to use Virtual Scrolling and Custom Paging.
Thanks,
Shinu
