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

index ??

8 Answers 410 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Louis asked on 14 Sep 2007, 12:43 AM
dumb question maybe but i cannot find this property

how can i get the row index of the CurrentRow?

And is there a way of creating a new row when the user press tab on the last cell of the grid. What event should i trap ?

Thanks

8 Answers, 1 is accepted

Sort by
0
Tony
Top achievements
Rank 1
answered on 14 Sep 2007, 01:00 AM
Hi Louis,

Try this for the row index:

Me.RadGridView1.CurrentCell.RowIndex

0
Louis
Top achievements
Rank 1
answered on 14 Sep 2007, 01:30 PM
ok thanks.

How could i handle the tab pressed on the last cell on a row. I want to move the current row to the next available row?

thanks
0
Jack
Telerik team
answered on 14 Sep 2007, 04:17 PM
Hi Louis ,

The standard behavior of RadGridView is to move the current row to next available row, when hte tab key is pressed on the last cell. This behavior is controlled by the StandardTab property of RadGridView. If it is set to true, the grid does not process the tab key.

Currently it is not possible to override grid's default key handling. We would suggest setting the AllowAddNewRow property to true and AddNewRowPosition to PinnedRowPosition.Bottom:

this.radGridView1.MasterGridViewTemplate.AllowAddNewRow = true;
this.radGridView1.MasterGridViewTemplate.AddNewRowPosition = PinnedRowPosition.Bottom;

All the best,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Louis
Top achievements
Rank 1
answered on 18 Sep 2007, 06:33 PM
i have a question regarding the index?

in code to select a row manually i do 

this.grdSearchResults.MasterGridViewInfo.CurrentRow = this.grdSearchResults.Rows[idx];

this.grdSearchResults.GridElement.Update(false);

then you told me if i want the index of a row to do this

grdSearchResults.CurrentCell.RowIndex

if i select manually a row then try to access its index with 
grdSearchResults.CurrentCell.RowIndex
an exception gets trhown cause the current cell is null.?

man i'm struggling here to do basic things!!!
could you explain what is the difference between accessing row from MasterGridViewInfo and accessing row from datagrid object directly?

i only want to know at a time t what is the selected row and the corresponding index of that row in the grid?? basic no?




0
Jack
Telerik team
answered on 19 Sep 2007, 05:15 PM
Hi Louis ,

We are deeply sorry for the inconvenience caused.

We would recommend downloading and installing our latest release Q2 2007. We fixed many bugs, including some problems with the row selection. You do not need to call GridElement.Update after setting CurrentRow property anymore, so the new feature should take care of your problems.

The correct way to obtain row index is to call RadGridView.Rows.IndexOf function:

int index = this.radGridView1.Rows.IndexOf(this.radGridView1.CurrentRow);

Because of the specifics of Telerik Presentation Framework, to save memory and to improve performance, only the visible rows and cells are associated with visual elements. So, the CurrentCell.RowIndex will be correct only if this cell is visible. There are no differences between grid object properties and MasterGridViewInfo ones.

Let me know if you have other questions.
 

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Louis
Top achievements
Rank 1
answered on 19 Sep 2007, 06:36 PM
Ok Thanks with the IndexOf it seem's to be returning always consistent values. 

Are you planning to release a documentation sometime soon ?
It would really help getting your product running up faster.

Thanks
0
Louis
Top achievements
Rank 1
answered on 20 Sep 2007, 07:41 PM
Ok guys i'm facing a strange behavior now. 
i'm using this to set the current row 

this.grdSearchResults.MasterGridViewInfo.CurrentRow = this.grdSearchResults.Rows[idx];

this.grdSearchResults.GridElement.Update(false);

idx is in correct range.

the row in the grid appears as highlighted i cannot delete it. To do so i must hover on the line and then i will be able to delete it. If i'm in debug mode and tracing everything goes ok cause the refresh (or whatever) must be done. But if i just run the application the row does not delete?? Only if i hover it first it will delete after??

Would you be having some refresh problem on the current row or something??


0
Jack
Telerik team
answered on 21 Sep 2007, 02:45 PM
Hello Louis ,

The situation you describe is very strange. We don't expect any troubles with grid refreshing. In our new Quick Start Framework we have an example called "Business Grid". In this example the current row is deleted when a specific button is pressed. Please, take a look at it. Here is the code that we use for removing a row:

this.radGridView1.Rows.Remove(this.radGridView1.CurrentRow);

If this does not help, please send us your application so that  we will be able to investigate the issue deeply.

With our latest version there is no need to call the Update function anymore. You can also replace your code with one from the lines below:

this.grdSearchResults.CurrentRow = this.grdSearchResults.Rows[idx];
this.grdSearchResults.Rows[idx].IsCurrent = true;

We are actively working on the documentation. It was our plan to have a completely revised and I could say totally new documentation for RadGridView for WinForms but we couldn't make it for Q2. However you will find a considerable amount of API Reference documented for this release.

 
Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Louis
Top achievements
Rank 1
Answers by
Tony
Top achievements
Rank 1
Louis
Top achievements
Rank 1
Jack
Telerik team
Share this question
or