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

SelectionChanged Event and Manually adding rows

1 Answer 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 22 Sep 2008, 01:08 PM
I'm currently using the RadGridView.Rows.Add(new object[]) method to create a new row in a GridView on a button click.  Calling the Rows.Add method will trigger the SelectionChanged event twice, as expected, but a problem occurs when I try to access the properties of the newly added row via the  RadGridView.SelectedRows[0].Cells[0] properties.  I only get default values for the cells, and not the actual values that I provided in the Rows.Add(new object[]) call.

Is this a known issue, or is there a different way to get the Objects that have been added?

Thanks,
Chris

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 24 Sep 2008, 10:22 PM
Hello Christopher,

Thank you for writing.

Yes, this is a known issue with the SelectionChanged and CurrentRowChanged events. You cannot access cell values from CurrentRow and SelectedRows in these events. Unfortunately, there is not a work-around for this case.

One solution for your case is to keep inserted values in the previously created fields and use them immediately after adding the new row.

If you have other questions, do not hesitate to contact me again.

Regards,
Martin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or