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

How to Sync Column width of two grid placed one on top of another.

7 Answers 519 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Grr
Top achievements
Rank 1
Grr asked on 11 Feb 2011, 09:12 PM
I am trying to fake freeze top rows. So I have two grid and bottom one is adjacent to top one with no headers. It seems to work, but when I resize the top column the bottom does not re size.. So I managed to get it going with the code in columnWidthChanging, but the width changing in the bottom grid based on top one is funky as it changes width in both sides.
 index= topgridView.Columns.IndexOf(e.Column);
 bottomgridView.Columns[index].Width = e.Column.Width;
Is there a work around for this. I even tried setting the IsResizable property to false to all columns before subject column, but the property seems to does not work at all.
Any Help?

7 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 14 Feb 2011, 08:19 AM
Hi Grr,

You may take a look at this forum thread for a reference.
 

Best wishes,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Grr
Top achievements
Rank 1
answered on 14 Feb 2011, 06:26 PM
HI Maya,

I did look into that, but that is not what I need exactly, and also as per that forum listing, the solution did not seem very elegant for that reqirement.

My requriement is simple. Two independent GridView. No parent Child. Just want to sync column width.

Or let me put it this way, how to dynamically change the width of the column and increase it only on the right side and not both sides. If I have have a solution to that then my current approach will work.

Let me know if yo have any solution.

Regards,
0
Maya
Telerik team
answered on 17 Feb 2011, 05:03 PM
Hello,

I am sending you a sample project illustrating how you may achieve similar behavior. Let me know if it corresponds to your requirements.

 
Kind regards,
Maya
the Telerik team
0
Ralf
Top achievements
Rank 1
answered on 02 Sep 2011, 02:21 PM
Hi Maya,

may be i am a litttle bit to late for this thread, but i am trying to do the same things.
-> synchronize the width of child grid columns with a parent grid

On a first glance your sample works, but not in every case, so if you switch to an edit template
and the width changes but the event is not fired.

Do you know a Solution for EVERY column width change ?

Regards, Ralf
0
Pavel Pavlov
Telerik team
answered on 02 Sep 2011, 02:43 PM
Hello Ralf Bellmann,

I believe the solution suggested by Maya is as close as we can get.
In your case I would rather recommend to fix the width of the column , so it can be resized only by the user and not by changes in contents.

Regards,
Pavel Pavlov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Ralf
Top achievements
Rank 1
answered on 02 Sep 2011, 03:17 PM
Hi Pavel,

thanks for the very quick Reply.
So i must look for a workarround.

I dont really want to know the reason  for this behavior :-(

Bye
Ralf
0
Ralf
Top achievements
Rank 1
answered on 05 Sep 2011, 07:29 AM
Hi everyone,

may be some one find this usefull.
To react on every column width change, put a usercontrol in the Header.
In the UserControl you can override ArrangeOverride and you get all (hopefully) width changes.

bye ralf
Tags
GridView
Asked by
Grr
Top achievements
Rank 1
Answers by
Maya
Telerik team
Grr
Top achievements
Rank 1
Ralf
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or