Objectdatasource Update Multiple Rows
When answering a question please: • Read the question carefully. • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar. • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
• Don't tell someone to read the manual. Chances are they have and don't get it.
I'm unable to update or delete multiple rows in db table using LINQ. All the examples I have seen so far are done like this:Product prod = conte. I am trying to update multiple rows based on user selection with. At System.Web.UI.WebControls.ObjectDataSource.Update(). Multiple Row Update in Gridview. When editing is enabled for a GridView control, by default only one row can be edited at a time. Here Mudassar Ahmed Khan has explained how to Bulk Edit Update Multiple Rows or records in ASP.Net GridView at once using CheckBoxes on single click. Upload Files Jsp Ftp. In this example.
Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
Hello, I have a table called t_data containing the following columns: id, iYear, iMonth, iValue, fk_t_relation_id The fk_t_relation_id column is linked to the id of a project table so for a single year, 12 rows in t_data have the same fk_t_relation_id. In my gridview I use a stored procedure to show the data from each project on a single row with all the months in that row instead of 12 rows for a single year. The problem comes when I try to edit the values in my grid. I use the following stored procedure: ALTER PROCEDURE [dbo].[updateData] @iYear int, @id int, @iJan int, @iFeb int, @iMar int, @iApr int, @iMay int, @iJune int, @iJuly int, @iAug int, @iSept int, @iOct int, @iNov int, @iDec int AS BEGIN UPDATE t_data SET iValue = @iJan WHERE fk_t_relation_id = @id AND iYear = @iYear AND iMonth = 1 UPDATE t_data SET iValue = @iFeb WHERE fk_t_relation_id = @id AND iYear = @iYear AND iMonth = 2 UPDATE t_data SET iValue = @iMar WHERE fk_t_relation_id = @id AND iYear = @iYear AND iMonth = 3 And so on for each month. @id in my gridview corresponds to the id of the project in t_relation, or the value of fk_t_relation_id in t_data. The procedure works fine when testing it in SQL Server 2005 but I do get problems when testing it in my application. I get no error message but the update simply doesn't go through.
Here are the columns in my gridview: And finally, here are my update parameters: I really have no clue as to how to identify the error. Any help will be appreciated. Please do tell if you need more information as I am new to the subject.
In design view click on your GridView. Go to properties, select events for the grid and double click RowUpdating and RowUpdated. It would create two event handlers for your in the cs file.
Now, we need some code in these methods. For now, just put something like string RowUpdating = '; in the first method and string RowUpdated ='; in the second method. Put breakpoints into both methods. Then we would need to examine e.NewValues[] in the watch window, e.Exception and other things. Can I Install Norton Antivirus In Safe Mode on this page. I believe both these events are fired when you edit a record in the grid directly. Ok, I ran the application in debug mode with the code you suggested and with breakpoints on RowUpdating and RowUpdated.