We have a grid and need to automatically adjust column width when the data source changes. CalculateAutoResizeWidth works fine on grid column normally, but the problem comes when data source contains DbNull. The calculated column width is much wider if data contains DbNull. Is there any work around this problem?
Thanks,
Zongwen
Hi Zongwen,
I ran your sample and I see the results you described - although the captions on your buttons are reversed - the one that says "w/o DBnull" has a null and the other one doesn't. :)
Anyway, one thing you did not mention initially is that the column is using a masked editor. It looks like what's happening here is that when there's a value in the cell, the measurement is being performed on the text that is displayed in the cell. When the value is null, the editor is measuring based on the mask, which is much longer than any of the values you have in this column, so that's why the cell is getting bigger.
I'm not sure why that's happening - it might be a bug, but there might be some reason for it. So it's something the developers will need to look into in more detail.
I'm going to ask Danko to enter this as a bug for developer review.
Hello Zongwen,
I have created the following case for you: CAS-58409-RGP0DL
We can continue our conversation throught the case or here in the forum. As soon as I have any information for you I will let you know.
Please let me know if you have any other questions.
Hi Mike,
Attached is the sample program I created using Visual Studio 2008 and Infragistics WinForm 10.2.
Could you please check to see where I am doing wrong?
I have never heard of this happening before. There is no reason why a DBNull in a cell should cause the autosize to make the cell bigger.
Can you duplicate this in a small sample project and post it here?