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

SelectNextRow the group does not work

6 Answers 173 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ali
Top achievements
Rank 1
Ali asked on 22 Sep 2013, 11:36 AM
SelectNextRow the group does not work
 radGridView1.GridNavigator.SelectNextRow(1);
When the next group arrives Does not work.

6 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 25 Sep 2013, 02:46 PM
Hi Ali,

Thank you for contacting Telerik Support.

I was not able to reproduce the issue you are describing on my end. Please find attached below my sample project which I used for my tests. Can you please provide me with some additional information or a sample project which will help me to further investigate your case.

Thank you for the cooperation, looking forward to your reply.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ali
Top achievements
Rank 1
answered on 27 Sep 2013, 03:26 PM
tanks
When I hit Enter key to go to the next row
I like when the group arrives. The group did not stop.
And go to the next row.
But the group arrives. collapse is


namespace RadGridViewSelectNextRow
{
    public partial class Form1 : Form
    {
        private RadGridView grid = new RadGridView();
        private RadButton btn = new RadButton();
        private Random rnd = new Random();
        private List<Dummy> dataSource = new List<Dummy>();
 
        public Form1()
        {
            InitializeComponent();
            this.grid.Dock = DockStyle.Fill;
            this.grid.Parent = this;
            this.grid.AutoSizeColumnsMode =  GridViewAutoSizeColumnsMode.Fill;
             
            this.btn.Dock = DockStyle.Bottom;
            this.btn.Text = "Move to next row";
            this.btn.Click += btn_Click;
            this.btn.Parent = this;
 
            for (int i = 0; i < 100; i++)
            {
                this.dataSource.Add(new Dummy
                {
                    Id = rnd.Next(0, 6),
                    Name = "Name number " + i
                });
            }
 
            this.grid.DataSource = this.dataSource;
 
            this.Load += Form1_Load;
 
            this.grid.KeyUp += new System.Windows.Forms.KeyEventHandler(this.radGridView1_KeyUp);
 
        }
 
        void Form1_Load(object sender, EventArgs e)
        {
            GroupDescriptor descriptor = new GroupDescriptor("Id");
            this.grid.GroupDescriptors.Add(descriptor);
            this.grid.MasterTemplate.AutoExpandGroups = true;
        }
 
        void btn_Click(object sender, EventArgs e)
        {
            this.grid.GridNavigator.SelectNextRow(1);
        }
        private void radGridView1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.grid.GridNavigator.SelectNextRow(1);
                this.grid.BeginEdit();
            }
 
        }
    }
 
    public class Dummy
    {
        public int Id {get;set;}
        public string Name {get;set;}
    }
}
0
George
Telerik team
answered on 01 Oct 2013, 01:29 PM
Hello Ali,

Thank you for writing back.

In that case you need to change the default behavior of the grid. You can create a custom GridGroupRowBehavior:
public class MyRowBehavior : GridGroupRowBehavior
{
    protected override bool ProcessEnterKey(KeyEventArgs keys)
    {
        return false;
    }
}

The behavior can be used as follows:
((BaseGridBehavior)this.grid.GridBehavior).UnregisterBehavior(typeof(GridViewGroupRowInfo));
((BaseGridBehavior)this.grid.GridBehavior).RegisterBehavior(typeof(GridViewGroupRowInfo), new MyRowBehavior());

I hope this helps.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ali
Top achievements
Rank 1
answered on 03 Oct 2013, 07:34 AM
tanks
0
Björn
Top achievements
Rank 1
answered on 07 Mar 2014, 09:25 AM
[quote]George said:
The behavior can be used as follows:
((BaseGridBehavior)this.grid.GridBehavior).UnregisterBehavior(typeof(GridViewGroupRowInfo));
((BaseGridBehavior)this.grid.GridBehavior).RegisterBehavior(typeof(GridViewGroupRowInfo), new MyRowBehavior());
[/quote]

I'm so sorry about it.
I implemented it on monday as shown above and ran it successfully, but next day it does not work anymore.
I can reproduce it on my pc that it dont work, but on another computer it does run normally. Both systems does have the same source code from monday. So I didn't changed it.

No breakpoint in my custom behavior hit anymore. And yes, the behavior is registered and nowhere removed or unregistered. Do you have any suggestions for me?

I thought, maybe it's not the correct registeration type when register the behavior.

regards

Björn (Bjoern)
0
George
Telerik team
answered on 12 Mar 2014, 07:21 AM
Hello Bjorn,

Thank you for contacting us.

From the provided information I find it hard to understand what the root of the problem may be, moreover that without any change in your code the behavior changed. 

That is why I would like to kindly ask you to provide me with a sample project where this behavior is reproduced so I can investigate this case properly. 

Looking forward to your response.

Regards,
George
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Tags
GridView
Asked by
Ali
Top achievements
Rank 1
Answers by
George
Telerik team
Ali
Top achievements
Rank 1
Björn
Top achievements
Rank 1
Share this question
or