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

BestFitColumns problem

4 Answers 193 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ShareDocs
Top achievements
Rank 1
ShareDocs asked on 08 Jan 2013, 06:25 AM
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?

4 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 10 Jan 2013, 02:14 PM
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.
0
ShareDocs
Top achievements
Rank 1
answered on 13 Jan 2013, 05:36 AM
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...
0
ShareDocs
Top achievements
Rank 1
answered on 15 Jan 2013, 11:42 AM
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.
0
Plamen
Telerik team
answered on 16 Jan 2013, 12:34 PM
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.
Tags
GridView
Asked by
ShareDocs
Top achievements
Rank 1
Answers by
Plamen
Telerik team
ShareDocs
Top achievements
Rank 1
Share this question
or