First, I load up some data: After that, I’m doing some work to make my Grid View look beautifull, adding all columns by hand.But for this demo, I’ll show you the simple version, that also doesn’t work 🙂Let’s bind the data to our Grid View and have it autogenerate our columns, as well as an edit button.If the values are alternated in the hashtable they are applied to the grid and carried over to the data source as well.I am using a SQLData Source to populate my gridview in ASP. When I hit Edit, the textboxes appear and I am able to edit my values. I am using a SQLData Source to populate my gridview in ASP. When I hit Edit, the textboxes appear and I am able to edit my values. In the Row Editing function, the edit textboxes appear and I can get the "old" values Then the page renders, I edit the textboxes and hit Update.If the grid contains templated columns or is bound to some of the fields from the data source, the Values and Old Values must be updated to add those missing values.
Do you have some sort of Java Script functionality that may be stopping it? A common problem people have with Grid Views is understanding when to data bind the data source to the Grid View.For example a Sql Data Source, which is automatically added to your Web Form if you drag-n-drop your way around Visual Studio 2005.The problem is, I’d very much like to do so, if ASP. But I can’t set a Data Source property or anything on the Sql Data Source!!! I probably have to read the cells on the Grid View of the selected row, find the controls, get the values from those and insert those into my Data Set.Binding a Grid View control can sometimes get tricky when using the Visual Studio editor, especially when working with Drop Down List controls within the grid. Today I was working on getting a row of the Grid View control to save the contents of a Drop Down List, and needed to add some custom code to set values passed to the Sql Data Source control on the update event.