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

Rowindex Problem in GridView?

2 Answers 117 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vidhya
Top achievements
Rank 1
Vidhya asked on 14 Oct 2010, 06:26 AM
Hi...

In grid View Control while  adding the rows some time it passing row index value as -1.i saw what is the reason and i found it.

1)First time Grid shows  click here to add new row.so  we click the row and adding values continuously.in the last column we press tab or enter ,it adds new row  and adding values that time if any event occur,row index is passing as -1.
2) reason is , if  grid shows  Click here to add new row ,the grid passes row index correctly.or else it passes -1.

Please help me...is there any way to avoid this?

2 Answers, 1 is accepted

Sort by
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 14 Oct 2010, 08:06 AM
Hello Vidhya,

The row index for the GridViewNewRowInfo is -1, to differentiate it from the other rows in the grid.
When you press enter to add a new row, there are 2 events that are firing, UserAddingRow and UserAddedRow if I'm not mistaken, in these events, if you want you can manipulate data, add the item manually to the collection and so on.
When the row has been added to the collection, it's row index will be the one of the last row in the grid.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Vidhya
Top achievements
Rank 1
answered on 15 Oct 2010, 06:16 AM
Thank you.....

 i added rows manually .its working well....

but now another problem is coming ....

that is ,i have set  EnterMovesToNextCell to  Enter moves to next cell.it works before well.

but if we add rows manually...it is not going next cell ,if we press enter it is still in that position
Tags
GridView
Asked by
Vidhya
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Vidhya
Top achievements
Rank 1
Share this question
or