views:

26

answers:

2

I have a set of data that has been displayed as just a simple GridView with the item name being a hyperlink to view details. I'm attempting to update this scenario so certain fields (sortOrder and isApproved) are editable from the main page and do not require visiting each item in the grid.

I have converted the GridView to a DataGrid and have included a TemplateColumn for the columns in question. I have them hooked up to display the values appropriately. At this point, I'm trying to find a way to peek into the DataGrid and it's related data source to determine if the values have changed on the click event of a button. At that point, I could persist those changes back to the respective SharePoint list.

I'm not very familiar with the DataGrid, or GridView for that matter. Can anyone point me in the correct direction on how I could gain access to the data source at an item/row level during a button click event?

A: 

I needed to learn about DataGrid a while back and asked the question about some good tutorials. The post is located at: http://stackoverflow.com/questions/367559/good-datagridview-tutorial

To see if any values have changed you will probably have to set a store the row id somewhere when something is changed, then go through all the rows that have changed and do your update.

I hope that helps.

instigator
+1  A: 

If you add an event handler for ItemCommand, you can then access e.Item.DataItem to get at the data for a particular row.

I believe for a GridView the equivalent would be RowCommand, but not sure off the top of my head.

Bryan