ItemUpdating using DataSource(FormView or DetailsView)

Discussion in 'ASP .Net' started by =?Utf-8?B?Y2lzY28=?=, May 22, 2006.

  1. 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?
    =?Utf-8?B?Y2lzY28=?=, May 22, 2006
    #1
    1. Advertising

  2. 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.
    Walter Wang [MSFT], May 23, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Y2xpY2tvbg==?=

    Null Values in ItemUpdating Event

    =?Utf-8?B?Y2xpY2tvbg==?=, May 25, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    4,277
    =?Utf-8?B?Y2xpY2tvbg==?=
    May 25, 2006
  2. Timothy H. Schilbach

    DetailsView ItemUpdating woes...

    Timothy H. Schilbach, Oct 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    3,444
    Timothy H. Schilbach
    Oct 25, 2006
  3. £ukasz Ledóchowski

    FormView ItemUpdating event and empty NewValues...

    £ukasz Ledóchowski, Jan 1, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    854
    £ukasz Ledóchowski
    Jan 1, 2008
  4. Marius Manolea
    Replies:
    0
    Views:
    1,005
    Marius Manolea
    Jun 4, 2008
  5. Nic
    Replies:
    0
    Views:
    1,471
Loading...

Share This Page