Net gridview rowupdating event
Edit, True) obj Sql Param = New Sql Parameter("@New Expired ID", Sql Db Type. New Values("Property ID_Expired") 'The parameter is case sensitive. 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.When I hit Update, the changes are not saved, and there is no error message. When I hit Update, the changes are not saved, and there is no error message. Then the page posts back, the text boxes go back to being labels and the new values are lost, and the Row Updating code never fires. Yes, I did put the breakpoint at the Row Updating line (and not in the function).Is Post Back) otherwise you'll wipe out the new values everytime before the updating event gets called.
I would recommend trying this out and starting a new thread in the .
I'd like to know if there are any other ways to retrieve the new values? I have been using the web site successfully for just over a year, and I am presently using a Select button in the row to launch a detailsview, and I edit the database that way. Net a year and a half ago, and VB programmer forever before that, but I feel pretty confident in this large and powerful website I have created, but the users don't like the details view have expressed a desire to edit on the fly in the gridview. My user base has a hold of management's ear, and my management wants to dump ASP. This could be the straw that broke the camel's back - a person's job hangs in the balance - MINE!! If you are databinding in page_load then you need to only do it if(!
There must be something fundamentally wrong that some of us are doing that is causing this and the fact that it's not happening to others, and they don't know the solution. this only works when the databind happends after the updating. My suggestion to you would be to either subclass gridview, and expose the Extract Row Values though a public method or stick everything you need in Data Keynames. Extract Values From Cell(dict Values, dcfc Cell, gv Row. Row State, True) End If Next control Dim return Values = New Dictionary (Of String, Object )() For Each de As Dictionary Entry In values return Values(CStr(de. Value Next de Return return Values End Function I appreciate your quick and prompt reply, which I looked at from home last night, but was not able to test it until just now, and really the only different was adding the Try Cast. You're trying to extract the values from the edit row right?
Now, when an user edit a row then click update, I'm having problem getting the new values in gridview's rowupdating event, it always returns the old values. With that being said you could go directly after the form post data perhaps, i usually find it's easiest to debug then search through and find your key value pair. I'll take a closer look at your posts maybe tomorrow, and definitely Monday, but I'm just a hack, and I so close to dumping this whole thing and lettting someone else do it...whooops there isn't anyone else... The new values are not being retrieved, just the old values. Excuse my crude Msg Box methos; it only goes to prove what a hack I am. Controls Dim dcfc Cell As Data Control Field Cell = o Ctl If dcfc Cell Is DBNull. Controls Dim cell As Data Control Field Cell = Try Cast(control, Data Control Field Cell) If cell Is Not Nothing And Also cell. By the way, when I attempted to cut and paste your code, the compiler would not accept the arguments (String, Object) at the end of IDictionary, saying that IDictionary has no parameters, and also in the return values portion below it complains that Dictionary is not a type. Dictionary is a generic type and you have to include System. I'm not sure whats going on in your case Yes I am getting the exact data that's in the edit row. It's a record that looks similar to the other data in the database, but it is defintiely different values so I am confident that I am looking at the edit row.
I believe that databinding on every postback is the cause but that's not something that I can change right now, same goes with the autogeneratedcolumns setting. I'm not sure if I know what you mean about 2 way binding. If you meanam I using Bind instead of Eval in my HTML, then yes. And the result of your code is no different than my version or what I was doing before, which was just using the findcontrol method, and that just returns what was in the grid when it was first binded to the database on page load. Yes ok i think i know what you are probably doing wrong.