Hi,
I finally got to playing around a bit with Linq today. I'm using VS2008 (offcourse) and NetAdvantage for ASP.NET 2007 vol 3. For some reason I can't get the ultrawebgrid to update or delete records in the database. The insert statement seems to work fine though.
Here's what I did:- I placed a ultrawebgrid on a new aspx form and chose the LinqDataSource as my data source.- I connected the LinqDataSource to the correct object in my data layer and enabled insert/update/delete features on it The data was displayed correctly, but at first all newly added rows in the grid weren't sent to the database. I noticed no postback (I use an AJAX enabled grid) was issued for new rows. By adding an event handler for the 'UpdateRow' event I was able to trigger a postback (though the event handler itself was empty) and correctly insert a new record into the database.
So far so good, but unfortunately the same trick didn't apply to updating and deleting records. A postback is issued and I can effectively add breakpoints to the UpdateRow and DeleteRow events of the grid, but these updates arent sent to the datasource. I tried adding event handlers for the Updating and Deleting events the DataSource has, but those events aren't fired at all. I also tried calling UpdateDBRow and DeleteDBRow for the correct row passed to the event handlers, but that doesn't do the trick either.
Is there something I'm overlooking? Any help would be appreciated, thanks!
Hi Helen,
I tried your approach and turned off the AJAX mode, didn't help unfortunately.
I found out some things though:- With a normal grid, it works fine. I had some problems at first, but after clearing the page and starting over it all worked well. I used SQL profiler to watch all SQL statements in de database and saw only predictable things.- It seems to be impossible to use both the normal and the infragistics grid on the same datasource. I get exceptions notifying me of duplicate keys while there aren't any; only when both grids are on the same page.- The UltraWebGrid still won't delete. The delete event of the linqdatasource never gets called so I guess that's not strange at all. I think it has probably something to do with the way the LinqDataSource handles a delete. That seems to differ from the way an ObjectDataSource does it for instance. I'll notify developer support and see if they can help me with this, thanks.
I'd recommend turning off ajax and trying to get the updates working in regular postback mode. Exceptions that are thrown during updates tend to get swallowed by ajax mode unless you are explicitly looking for them.
Also try hooking your data source up to a MS DataView to make sure there's no problems with the linq data source itself.
It's possible that the linq scenario that you're trying isn't supported in 7.3. Support for VS2008 features is something that's being worked on for the 8.1 release. If you find you are running into problems, I'd recommend letting developer support know. They'll be able to pass it on to the development team as a bug to make sure that it works in the new version.