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

Synchronized column sizes across grids

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dean
Top achievements
Rank 1
Dean asked on 22 Oct 2008, 02:04 PM
I looked through the forum and didn't find anything like what I'm after.

Basically, I want to have two grids with the same columns but representing different data. If the user resizes the columns in one, then I want the other one to have its columns the same width, calculated on the client side.

The documentation doesn't mention anything about manipulating the column widths using a client-side script, so I'm not even sure if this kind of width manipulation is possible. If it's not possible, that's fine. I have other options to consider, but this one is the best for me (assuming there's an easy way to do it).

The basic idea would be to catch the OnColumnResized event of one grid and use that to resize the appropriate column in the second grid. Is it possible to do this? If so, how?

Thanks in advance,
Dean

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 24 Oct 2008, 02:06 PM
Hello Dean,

Indeed you can handle the OnColumnResized client event for your purpose. In this topic you can find how to get the resized column width and cellIndex. Then you can use the grid client-side API to set the width of the respective column in the second grid. Find some useful client-side properties:

http://www.telerik.com/help/aspnet-ajax/grid_getcellbycolumnuniquename.html
http://www.telerik.com/help/aspnet-ajax/grid_getcolumnuniquenamebycellindex.html
http://www.telerik.com/help/aspnet-ajax/grid_control_column.html

All the best,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Dean
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or