开发者

Saving a batch of changes from a DataGrid or GridView

开发者 https://www.devze.com 2022-12-16 21:17 出处:网络
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 isA

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?


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.


I needed to learn about DataGrid a while back and asked the question about some good tutorials. The post is located at: 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消