Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 26th, 2006, 11:57 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default What does ObjectDataSource.Update do?

Hi,

I have a FormView control which I'm trying to have automatically update when the user changes pages (I'm duplicating an Access front-end, and in Access you don't explicitly have to "Update" a record to save your changes to it - you just go to a different record).

My FormView uses an object datasource that I declared on the ASPX page. Maybe that's my problem.

Anyway, I wrote this method...

Code:
Protected Sub FormViewPaging(ByVal sender As Object, ByVal e As FormViewPageEventArgs) Handles FormView1.PageIndexChanging
        Me.ObjectDataSource2.Update()
End Sub
Which doesn't do a damn thing.

So what I really want to do is two thing:

 (1) Update the FormView's underlying dataset
 (2) Update the underlying database

Any Suggestions? Thanks.

Aaron

 
Old November 27th, 2006, 05:40 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well I think I have answered my own question. The short answer is: it can't be done. Just forget it, hang it up and go home.

We, as developers, have no access to any datasource that was set up declaratively. If you want programmetic access to thd data in a FormView (or GridView or DetailsView for that matter), you have to bite the bullet do the data binding manually. This of course means you have to do everything else manually as well. There doesn't seem to be a happy medium.

So my paging handler features a standard update routine where I get references to all the controls, set up SQL Paramaters and execute an update query. Very tedius, since the form has 60 controls on it. But Oh Well.

Thanks for reading.

Aaron






Similar Threads
Thread Thread Starter Forum Replies Last Post
ObjectDataSource in UserControl Colonel Angus .NET Framework 2.0 0 April 3rd, 2008 10:14 AM
ObjectDataSource Best Practices? TKelley4591 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 July 20th, 2007 02:39 PM
CH5 ObjectDataSource nabeelalkaff BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 March 8th, 2007 01:19 PM
Chapter5 ObjectDataSource nabeelalkaff BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 March 5th, 2007 01:15 AM
Formview with ObjectDataSource rturner003 ASP.NET 2.0 Professional 3 November 1st, 2006 06:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.