Hi all
We moved from the standard DataGridView to the RadGridView.
The DataGridView has an item property where you can set the column and row index yourself.
The 1 being the column position and 15 the row position.
What is the RadGridView equivalent?
Thank you
We moved from the standard DataGridView to the RadGridView.
The DataGridView has an item property where you can set the column and row index yourself.
dgvGrid.CurrentCell = dgvGrid.Item(1, 15)
The 1 being the column position and 15 the row position.
What is the RadGridView equivalent?
Thank you
12 Answers, 1 is accepted
0
Hi culminIT Pty. (Ltd),
GridView has no build in method. However with two lines of code one can create similar functionality.
I have prepared sample application using extension method to achieve similar functionality.
If you have any other question or issues do not hesitate to contact us.
Sincerely yours,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
GridView has no build in method. However with two lines of code one can create similar functionality.
I have prepared sample application using extension method to achieve similar functionality.
If you have any other question or issues do not hesitate to contact us.
Sincerely yours,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

CulminIT
Top achievements
Rank 2
answered on 18 Mar 2010, 09:29 AM
Hi
Sorry, I forgot to tell you that I am using Win Forms radgrid.
So there's no SelectedItem or Item option. Or am I mistaken?
Thank you
Sorry, I forgot to tell you that I am using Win Forms radgrid.
So there's no SelectedItem or Item option. Or am I mistaken?
Thank you
0
Accepted
Hello,
This forum is for our WPF RadGridView - you can post your question in the relevant category.
Sincerely yours,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
This forum is for our WPF RadGridView - you can post your question in the relevant category.
Sincerely yours,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

R Shah
Top achievements
Rank 1
answered on 02 Apr 2010, 04:24 PM
I'm trying to get same functionality - there is a "radGridView1.ScrollIntoView" but not "radGridView1.ScrollIntoViewAsyn" which you have mentioned in the code. With "ScrollIntoViewAsyn" I'm getting error "No overload for method.............
What I belive I haven't updated .dll's - Please advise
Thanks,
What I belive I haven't updated .dll's - Please advise
Thanks,
0
Hi R Shah,
You will need the latest version of the assemblies since this method is new.
I hope this helps.
Greetings,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You will need the latest version of the assemblies since this method is new.
I hope this helps.
Greetings,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Julien Barbé
Top achievements
Rank 1
answered on 07 May 2010, 02:52 PM
Hello,
This sample is not working for me. I have modified the code sample (added more columns), so that the gridview has an horizontal scrollbar. The cell I want to set as current is in the last column, that is outside of the current view.
If you put 8 as row index and 6 as column, I was expected that the cell from column Country should be selected and the horizontal scrollbar should scroll to that cell.
But this is not the case. The good row is selected, but it is the first cell from that row that is selected.
I also tried this code:
But is is not working too.
Can you help
Thank you.
This sample is not working for me. I have modified the code sample (added more columns), so that the gridview has an horizontal scrollbar. The cell I want to set as current is in the last column, that is outside of the current view.
return (from c in Enumerable.Range(0, 10) |
select new Person |
{ |
Age = c, |
ID = c, |
Name = "Name" + c, |
Street = "Street" + c, |
Zip = "Zip" + c, |
City = "City" + c, |
Country = "Country" + c |
}).ToList(); |
If you put 8 as row index and 6 as column, I was expected that the cell from column Country should be selected and the horizontal scrollbar should scroll to that cell.
But this is not the case. The good row is selected, but it is the first cell from that row that is selected.
I also tried this code:
var targetColumn = SampleGrid.Columns[6]; |
SampleGrid.SelectedItem = SampleGrid.Items[8]; |
SampleGrid.ScrollIntoViewAsync(SampleGrid.SelectedItem, targetColumn, (c) => c.Focus()); |
But is is not working too.
Can you help
Thank you.
0
Hello Julien Barbé,
You should modify your code a little bit since FrameworkElement that will be scrolled into view is GridViewRow not cell or column, so when you call GridViewRow.Focus() this will focus first cell from that row.
I hope this will help.
Greetings,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You should modify your code a little bit since FrameworkElement that will be scrolled into view is GridViewRow not cell or column, so when you call GridViewRow.Focus() this will focus first cell from that row.
var targetColumn = SampleGrid.Columns[6];
SampleGrid.SelectedItem = SampleGrid.Items[8];
SampleGrid.ScrollIntoViewAsync(SampleGrid.SelectedItem, targetColumn, (f) =>
{
GridViewRow row = f
as
GridViewRow;
if
(row !=
null
)
{
row.Cells.Cast<GridViewCell>().First(c => c.Column == targetColumn).Focus();
}
});
I hope this will help.
Greetings,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Julien Barbé
Top achievements
Rank 1
answered on 17 May 2010, 12:37 PM
It's working.
Thank you!
Thank you!
0

Gilbert Figueroa
Top achievements
Rank 1
answered on 10 Oct 2010, 01:28 PM
Hi Tsvyatko,
It will be possible you to up date cell select example with new update "SelectionUnit = Cell"
Regards,
It will be possible you to up date cell select example with new update "SelectionUnit = Cell"
Regards,
0
Hi Gilbert Figueroa,
Sincerely yours,
Milan
the Telerik team
Thank you for your suggestion. We will update the sample as soon as possible.
Sincerely yours,
Milan
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Chad
Top achievements
Rank 1
answered on 04 Nov 2010, 12:19 AM
I am only able to select and put in edit mode the first column in the row. I'm using the example project and then included Nedyalko Nikolov post as well.
I've narrowed the code down to just this.
But no matter what value is passed in for column it always selects the first column in the row. The BeginEdit works like a charm, but I want to set focus on column 2 or 3 or 4.
Thanks ... Chad
I've narrowed the code down to just this.
public static void SetSelectedCell(this RadGridView gridView, int row, int column)
{
gridView.SelectedItem = gridView.Items[row];
GridViewRow row1 = gridView.ItemContainerGenerator.ContainerFromItem(gridView.SelectedItem) as GridViewRow;
row1.Cells[column].Focus();
row1.BeginEdit();
}
But no matter what value is passed in for column it always selects the first column in the row. The BeginEdit works like a charm, but I want to set focus on column 2 or 3 or 4.
Thanks ... Chad
0

Chad
Top achievements
Rank 1
answered on 04 Nov 2010, 12:24 AM
Never mind, this seems to work for anybody else struggling with it.
public static void SetSelectedCell(this RadGridView gridView, int row, int column)
{
gridView.SelectedItem = gridView.Items[row];
GridViewRow row1 = gridView.ItemContainerGenerator.ContainerFromItem(gridView.SelectedItem) as GridViewRow;
((GridViewCell)row1.Cells[column]).BeginEdit();
}