Detailsview itemupdating newvalues
I'm using a detailsview with an sqldatasource in the aspx page.I'm trying to do some pre and post processing on some of the fields - basically to convert a html list to a newline separated list for editing and back to html to store in the database.
event is raised when an Update button within the Details View control is clicked, but after the update operation. Count in my Item Updating event I have no key in the collection even though I editing data." For some reason we are not given access to the keys of the collection but are allowed to change its values by using, e.You may want to use a Linq Data Source control which seems to keep the Data Context object persistent.Why would the count only be 7 or 8 when there are obviously more than 10 records? through an editable control for example), so when Item Updating fires, the parameter is not listed in the New Values collection yet, allowing your code to actually add it. Cheers, Imar --------------------------------------- Imar Spaanjaars ) Specified argument was out of the range of valid values. Find Control("File Upload1"), File Upload) If my File Upload. Delete(Map Path("~/Paintings/") & old File Name) my File Upload. Just for fun, try setting one of the other parameters (if you have any) that are already set by the UI. Parameter name: index Source Error: Line 32: Dim my Drop Down List As Drop Down List Line 33: my Drop Down List = CType(Details View1. Line: 34 ****** Here is my method that is being referenced in the error: Protected Sub Details View1_Item Updating(By Val sender As Object, By Val e As System. Find Control("Drop Down List1"), Drop Down List) e.
Find Control("Drop Down List1"), Drop Down List)Line 34: e.
I am binding a Details View using Linq in my code-behind form. Count in my Item Updating event I have no key in the collection even though I editing data. However, the values in each control are available so what I need to do is create a new linq object and populated it with the values in my form and then call Submit Changes() on the linq object. According to some books I have the Data Context object must be persistent to be able to edit, update, delete and insert .
I have an Item Updating event happening which is connected to a typical update button. Seeming that Web Apps are stateless that would be one area to look at. To List(), which does a conversion of the results of the query and any modification of this new list does not effect the Data Context and therefore not change can be made to the DB.
This allows you to provide an event handler that performs a custom routine, such as checking the results of the update operation, whenever this event occurs.
A Details View Updated Event Args object is passed to the event handler, which allows you to determine the number of rows affected and any exceptions that might have occurred.
Here is my detailsview: I tried adding a label to my page and then once updated Name had been assigned the value of the textbox I tried assigning that value to the label and it printed out the old product name not the one in the textbox.