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

Programmatic Manipulation

1 Answer 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ledcor Development Team
Top achievements
Rank 1
Ledcor Development Team asked on 31 May 2013, 04:23 PM
I'm missing something here. There's tons and tons of documentation for the RadGridView and yet I still can't find some simple documentation on what I'm looking for. I don't have a lot of .Net experience, so maybe that's the problem, not the Gridview.

I've got a bound gridview (in a WPF application) that gets populated from a dataset. When the user is finished and clicks the update button, I want my code to go through the grid, apply local business rules and formating to individual cell entries, delete records as necessary, and then send the grid contents back to the database.

I would like to go, row by row, through my grid, get the contents of a given column, modify it if necessary, and then call my Stored Procedure to take the data from the row and write it back to the database.

Do I have to set my gridview up as unbound to accomplish this?

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 05 Jun 2013, 02:00 PM
Hello Dave,

Generally it is not recommended to work with the visual elements. Since the RadGridView supports UI Virtualization, its rows/cells are reused and we do not recommend working with the visual elements. You could iterate trough the Items and Columns collections of the RadGridView instead. Here is a simple example of this:

foreach (Club club in this.clubsGrid.Items)
{
    // work with the 'club' data item;
}
  
foreach (GridViewColumn column in this.clubsGrid.Columns)
{
   // work with each column
}


Regards,
Yoan
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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