ItemUpdating using DataSource(FormView or DetailsView)

G

Guest

I've been trying to figure out how the client of a DetailsView or
FormView should handle the ItemUpdating event when setting the datasource
programatically. I want to do something simple like this:

formView.DataSource = new SomeUserObject[] { user };
formView.DataBind();

All the examples i've come across show a declerative data source being
used. Do i need to use ObjectDataSource? I can get the information going
through the cells by parsing the html but that smells funny.

the FormViewUpdateEventArgs always has the OldValues and NewValues
collection empty.(Keys is too). ModeChanging behaves differently when setting
the data source explicitly(documented in the docs) but i can't find anything
for the ItemUpdating event.

I can't seem to get the edited values. I feel i'm missing something simple
but i'm just not sure what! Maybe somehow i need to populate the NewValues
and OldValues myself?
 
W

Walter Wang [MSFT]

Hi,

Thank you for posting!

Yes, you need to use ObjectDataSource here to take full advantage of
ASP.NET 2.0's powerful Data Binding features.

You can learn more information about DataSource controls from following
articles:

#DataSource Controls and Declarative Programming
http://www.nikhilk.net/DataSourceControlThoughts.aspx

#Data Points: Data Source Controls in ASP.NET 2.0
http://msdn.microsoft.com/msdnmag/issues/05/01/DataPoints/


Regards,
Walter Wang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top