BestFitColumns problem

5 posts, 0 answers
  1. ShareDocs
    ShareDocs avatar
    91 posts
    Member since:
    Oct 2012

    Posted 08 Jan 2013 Link to this post

    Hi,
    I've got a grid with 22 columns, I want to be able to show the columns with a horizontal scroll bar,
    so I've set autosizecolumnmode to 'none' and used 'bestfitcolumns' method.

    the problem is that all the content got corrupted and is not showing properly (I've attached a screenshot to this thread),

    even when I don't use the 'bestfitcolumns' method the content is corrupted (only when I set 'autosizecolumnmode' to 'fill' the content shows right - but then I can't use the horizontal scroll bar)

    how can I achieve the desired result?

  2. Plamen
    Admin
    Plamen avatar
    132 posts

    Posted 10 Jan 2013 Link to this post

    Hello Lior,

    Thank you for writing.

    BestFitColumns method iterates over all cells and calls the BestFit method of GridViewDataColumn. It will be better to call these methods after setting the data source and after the first layout of the control. A good place would be the OnLoad or the OnShown method of your form:
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

    }

    If you continue to experience this issue, please open a support ticket and send me your application. I will try to locate the issue and find a proper solution.

    I am looking forward to your reply.

    Greetings,
    Plamen
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
  3. ShareDocs
    ShareDocs avatar
    91 posts
    Member since:
    Oct 2012

    Posted 12 Jan 2013 Link to this post

    Hi,
    as I wrote in the body of my post: "even when I don't use the 'bestfitcolumns' method the content is corrupted (only when I set 'autosizecolumnmode' to 'fill' the content shows right - but then I can't use the horizontal scroll bar)".

    so i can't see how your answer can help me.

    Hope there is a solution to this problem...
  4. ShareDocs
    ShareDocs avatar
    91 posts
    Member since:
    Oct 2012

    Posted 15 Jan 2013 Link to this post

    Hi,
    eventually I fixed the problem and here is the description and the solution:
    the problem: I had a gridview with cellformating viewCellFormatting event attached. inside the ViewCellFormating event i changed the textalignment to ContentAlignment.MiddleRight and set rightToLeft to false for numeric content (I'm Building a right to left app and the negative numbers doesn't shows right ).

    if GridViewAutoSizeColumnsMode was NOT set to Fill then after binding the data the columns were one on top another (see image in my first post).

    The Solution: I've disabled the event and used the formatstring to get the desired number formatting.

    B.T.W:
    the title of this post is misleading (i don't know how to change it) and it is not related to the problem.
  5. Plamen
    Admin
    Plamen avatar
    132 posts

    Posted 16 Jan 2013 Link to this post

    Hello Lior,

    Thank you for writing.

    I am glad that the issue you were facing is now resolved. It seems that I had a different idea of what you are looking for, so I apologize for not providing the information you need in my previous answer.

    As to the thread title, you can not change it. You can only edit your thread content.

    If you have any other questions, do not hesitate to contact us.

    Greetings,
    Plamen
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Back to Top