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

8 posts, 0 answers
  1. Grr
    Grr avatar
    9 posts
    Member since:
    Sep 2010

    Posted 11 Feb 2011 Link to this post

    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?
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 14 Feb 2011 Link to this post

    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>>
  3. Grr
    Grr avatar
    9 posts
    Member since:
    Sep 2010

    Posted 14 Feb 2011 Link to this post

    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,
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 17 Feb 2011 Link to this post

    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
  5. Ralf
    Ralf avatar
    10 posts
    Member since:
    Apr 2010

    Posted 02 Sep 2011 Link to this post

    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
  6. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 02 Sep 2011 Link to this post

    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 >>

  7. Ralf
    Ralf avatar
    10 posts
    Member since:
    Apr 2010

    Posted 02 Sep 2011 Link to this post

    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
  8. Ralf
    Ralf avatar
    10 posts
    Member since:
    Apr 2010

    Posted 05 Sep 2011 Link to this post

    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
Back to Top