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

Prevent Gridview Scrolling

9 Answers 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joe Bohen
Top achievements
Rank 1
Joe Bohen asked on 09 Sep 2009, 12:58 PM
Hi

I have a gridview with 200 records if I scroll to a row then  click on a checkbox cell to change the value the gridview automatically scrolls to the first row in the gridview, how do I prevent this from happening? The gridview is not set to autoscroll!
Regards
Joe

9 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 10 Sep 2009, 01:52 PM
Hi Joe Bohen,

Yes I confirm that this is a bug. We are aware of it and it will be addressed in the upcoming release. Unfortunately there is no available work around. I apologize for the inconvenience. Should you have any other questions, please don't hesitate to contact us back.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Axel Labrousse
Top achievements
Rank 1
answered on 10 Sep 2009, 03:26 PM
Hi, try this, it worked for me :

private void myGrid_CellValueChanged(object sender, GridViewCellEventArgs e)
{
            //TODO : to remove with the next release of Telerik (Q3 2009)
            //Fix the issue of the vertical scrolling after editing a checkboxCell value
            if (myGrid.ActiveEditor is RadCheckBoxEditor
             && myGrid.CurrentColumn != null)
            {
                myGrid.CurrentColumn = null;
            }
}
0
Joe Bohen
Top achievements
Rank 1
answered on 11 Sep 2009, 06:33 AM
Hi Jack, Alex

Thanks for the replys, thanks for your code Alex I will try it to see if it works for me and let you know.

Regards
Joe
0
Jack
Telerik team
answered on 11 Sep 2009, 02:48 PM
Axel, thank you for your suggestion. I am glad to hear that you have found a solution that works for you.

After some research I fond a solution that works in all cases. Here it is:

void radGridView1_CellValidated(object sender, CellValidatedEventArgs e) 
    if (this.radGridView1.CurrentCell is GridCheckBoxCellElement) 
    { 
        foreach (FilterExpression filter in this.radGridView1.MasterGridViewTemplate.FilterExpressions) 
        { 
            if (filter.FieldName == ((GridViewDataColumn)this.radGridView1.CurrentColumn).FieldName && 
                filter.Predicates[0].Function == GridKnownFunction.NoFilter) 
            { 
                this.radGridView1.MasterGridViewTemplate.FilterExpressions.Remove(filter); 
                break
            } 
        } 
    } 

If you have any questions, please don't hesitate to write us back.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe Bohen
Top achievements
Rank 1
answered on 17 Sep 2009, 10:40 AM

Hi Alex & Jack

Thanks for your suggested fixes I am sorry about the delay in responding to your posts, this is because I am on holiday! I have tried both suggested fixes without success, whenever the selected checkbox cell is selected the gridview scrolls to the top. Jack you seem so positive that this fix should work, why does it not work on my application?

Regards

Joe

0
Axel Labrousse
Top achievements
Rank 1
answered on 17 Sep 2009, 10:50 AM
Hi Joe,

My name is Axel not Alex :p

Does the problem happens when you check a box and then you press "Tab" key instead of select another row ?

For me it was working so I tried first to simulate a TAB key press using the code SendKeys("TAB") but it was not very clean, so i tried to put the currentColumn to another one to see if it was working and it worked, so at least i tried to just set the currentColumn to nothing and it worked too.

I'm sorry it doesn't work for you, maybe you don't use the telerik version I have (Q2 2009) or your grid has different configuration.
0
Joe Bohen
Top achievements
Rank 1
answered on 18 Sep 2009, 06:57 AM
Hi Axel

Do forgive my mistake it was not intentional! My problem may be caused by the way I am constructing the gridview which is bound to a table adapter and then three columns are added programable a text column and two checkbox columns. I will load the gridview using a loop through a dataset and see if this helps.

Regards
Joe
0
Axel Labrousse
Top achievements
Rank 1
answered on 18 Sep 2009, 08:00 AM
Hi Joe

No problem ! In my case I bind the gridView with a Dataset without doing a loop (grid.DataSource = myDataSet) and add columns dynamically with the right mapping name (FieldName). But I don't know if the way you bind your data has something to do with the problem, for me it's an event filter that occurs and should not. Because when you disable the filtering feature the problem does not occur.

Regards
Axel
0
Jack
Telerik team
answered on 18 Sep 2009, 11:13 AM
Hi Joe,

Maybe I shouldn't be so happy in advance. I thought that my solution covers all cases. Please send me your application and I will investigate further. I don't think that the issue is related to the binding. Thank you in advance for your cooperation.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Joe Bohen
Top achievements
Rank 1
Answers by
Jack
Telerik team
Axel Labrousse
Top achievements
Rank 1
Joe Bohen
Top achievements
Rank 1
Share this question
or