locked
Custom DataSourceView ExecuteUpdate - how to get Keys working? RRS feed

  • Question

  • User391134533 posted

    How to get the Keys IDictionary filled to use a custom DataSourceView (and a Custom DataSourceControl) with an editable GridView?

    My code runs almost ok, until the user click on "Update" button. The ExecuteUpdate method is called, but without the keys property contents, only visible values on GridView (new and old).

    How to get this working? Any sample code is welcome :)

    Wednesday, April 15, 2009 11:33 PM

All replies

  • User-2106054853 posted

    Hi,

    Could you clarify your scenario? What's ExecuteUpdate method? Please paste your current code here.

    Friday, April 17, 2009 2:05 AM
  • User391134533 posted

    Hi Allen, thank's for your replay.

    Sorry, let me explain. I'm building an NHibernate ASP.Net application, using NHibernate 2.0.1 and NHibernate.Linq. To use the GridView with NHibernate performing the Edit/Update/Delete functions, I'm also building an DataSourceControl, from this base class.

    After reading MSDN docs, and a few tutorials, I was trying to override the ExecuteUpdate method from my DataSourceView inherited class, to enable the update feature. My method recieved no keys on the IDictionary keys parameter from GridView on my tests.

    Alfter some hacking and refactoring with the code, I discovered my mistake. The GridView attribute DataKeyNames was empty on the aspx file. So, setting it to the correct value, makes my ExecupteUpdate, and latter the Delete implementation works like a charm!

    Thanks for the help, anyway. I'll build a how to for this on my Blog.

    Friday, April 17, 2009 8:09 PM