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

Problem with Grid / rows position

5 Answers 180 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 05 Jan 2011, 05:28 PM
Hello, I've got a problem with the grid position
In some specific case, the rows position in the RadGridView are too high.
So when the scroll bar is at the top, you are missing some rows
And when you are at the bottom, you have empty space.

So this happen when I call BeginUpdate();  EndUpdate(); while I'm scrolling.
And only scrolling with the left click (no wheel)
Use the sample code and left clic on the scrollbar, go all the way down, and Voila.
Everything go back to normal if you use the wheel all the way to the Top. But it's not acceptable for our user

const int CST_AUTO_EXPAND_START = 15; //Last %
bool m_alreadyScroll = false;
public Form1()
{
    InitializeComponent();
}
 
private void AddDatas()
{
    List<string> datas = new List<string>();
    for (int i = 0; i < 50; i++)
    {
        datas.Add("string" + i.ToString());
    }
        radGridView1.DataSource = datas;
}
 
public void ExpandPage()
{
    m_alreadyScroll = true;
    radGridView1.BeginUpdate();
    //Normally I would update my datasource here threw a background worker
    radGridView1.EndUpdate();           
}
 
private void Form1_Load(object sender, EventArgs e)
{
    radGridView1.GridElement.VScrollBar.ValueChanged += new EventHandler(VScrollBar_ValueChanged);
    AddDatas();
}
 
void VScrollBar_ValueChanged(object sender, EventArgs e)
{
    if (m_alreadyScroll)
        return;
    Telerik.WinControls.UI.RadScrollBarElement scrollBar = (Telerik.WinControls.UI.RadScrollBarElement)sender;
    int maxValue = scrollBar.Maximum - scrollBar.LargeChange;
    //if the scroll bar is in the bottom zone, we search for new data
    if (maxValue - maxValue * CST_AUTO_EXPAND_START / 100 < scrollBar.Value)
        ExpandPage();
}

5 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 05 Jan 2011, 06:38 PM
Hi Daniel,

I haven't yet tried this scenario (I will) but can you confirm which version you are using as there were several scrolling issues fixed in the latest 2010 Q3 SP1  release.
Thanks
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 05 Jan 2011, 08:48 PM
Hi Daniel,

I've tried out your code and could not replicate your issue. However, I have noticed from parts of your code that it looks like you are probably using quite an old version of the controls, less than Q2 2010? The latest, as per my post above it Q3 2010 SP1.

You can find the Release History for RadControls here. I'd suggest starting off by either upgrading or downloading the Trial Version of the latest controls so you can try out your code to see if you have the same issue with that. But from testing with your code posted here, it seems to work fine.

Hope that helps
Richard
0
Daniel
Top achievements
Rank 1
answered on 06 Jan 2011, 10:30 AM
Hi there, thanks for your reponse.
I'm currently using the Q2 2010.2.10.806

We currently can't offord to migrate to the Q3, and are willing to use any workaround.
Do you know if there is any way to refresh the "rows container" to reposition it correctly ?
0
Richard Slade
Top achievements
Rank 2
answered on 06 Jan 2011, 10:53 AM
Hi Daniel,

At the moment, I don't know of a workaround and it will be difficult for me to test as I'm on the latest version, but I will continue to have a look for you and let you know if I come up with a suggestion,
Regards,
Richard
0
Jack
Telerik team
answered on 10 Jan 2011, 09:35 AM
Hi Daniel,

I highly recommend that you try our latest release, which addresses a lot of issues. If this is not an option for you, you can use one of the following methods that will reinitialize the rows container:
this.radGridView1.TableElement.RowScroller.ScrollToItem(this.radGridView1.CurrentRow);
this.radGridView1.TableElement.RowScroller.UpdateScrollRange();      

I hope this helps.

All the best,
Jack
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Jack
Telerik team
Share this question
or