Sqldatasource updating event args wiki dating

I have a Sql Data Source that is supplying data to my Grid View.

sqldatasource updating event args-3sqldatasource updating event args-40sqldatasource updating event args-73

And yes, I know I can retrieve the values from the Data Keys collection as you noted, and this is one of the reasons I have used the Data Key Names property until today.

The main issue remains unanswered: The extra column names listed in Data Key Names are not updated with their new values when using Update button in Gridview edit mode...

If I removed the column names (except primary datakey) from the Data Key Names property (and closed/reloaded the page to clear any Data Keys array/control state) then the update command would work just fine again for these columns. are we bound to use Data Key Names for PRIMARY keys only (which should be read-only anyway), or does anyone have a better idea?

See text below, which states that all properties listed in Data Key Names are set to read-only..you use the Autogenerate Columns to True.

First let's start from Grid View's On Bubble Event: protected override bool On Bubble Event(object source, Event Args e) private bool Handle Event(Event Args e, bool causes Validation, string validation Group) We can see if the command name is "Update" it will call Handle Update method.

private void Handle Update(Grid View Row row, int row Index, bool causes Validation) Please focus on the bold one. Since you're using Sql Data Source it's Update method will be called here: public int Update(IDictionary keys, IDictionary values, IDictionary old Values) protected override int Execute Update(IDictionary keys, IDictionary values, IDictionary old Values) Pay attention to the bold lines.While error checking my update command for this setup I noticed something funny..of :( Any column from my database which was listed in the Data Key Names would not get the new value posted back when the update was performed.All other columns/parameters worked fine and was updated.Example, where ID is my primary key: Data Key Names="ID, First Name, Last Name" 'Does not update First Name or Last Name Data Key Names="ID" 'This works ok ...The only constant member of the Data Key Names property is my primary database key.If I take those extra column names out of the Data Key Names property, it works again...

Tags: , ,