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

Cell updated from code - value not appearing on Grid

1 Answer 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Churamani
Top achievements
Rank 1
Churamani asked on 03 Mar 2014, 02:42 AM
I am trying to update multiple rows of cells at once. Suppose the user selects 5 rows to be edited. The user updates the values only in the 1st row and then click on a button (Edit Selected Rows). The other selected rows should have the same value as the first row. 

But the values are not visible on the UI after the button is selected. However, when I double click on any cell in the other selected rows, the updated values then appears. How to make it appear by click of the button so that I need not have to double click on every cell to check if the values are updated

private void radButton_Edit_Selected_Click(object sender,  RoutedEventArgs e)
{
var x = grid_name.rdvRates.SelectedItems;
int counter = 1;
string score =string.Empty;
foreach (object y in x)
{
if (counter == 1)
{
score = SomeMethod.GetPropertyValue(y, "SCORE");
counter = counter + 1;
}
else
{
SomeMethod.SetPropertyValue(y, "SCORE", score);
}
}
}

public static void SomeMethod.SetPropertyValue(object obj, string name, object value)
        {
Type type = obj.GetType();
if (type != null)
{
PropertyInfo prop = type.GetProperty(name);
if (prop != null)
{
prop.SetValue(obj, value, null);
}
}
        } 

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 06 Mar 2014, 08:31 AM
Hi Churamani,

You can achieve your goal by manipulating the value of each selected item in GridView's RowEditEnded event. I have prepared a sample project showing you the approach. You can find it attached.

Regards,
Yoan
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

Tags
GridView
Asked by
Churamani
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or