Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 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 Professional 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
  #1 (permalink)  
Old October 26th, 2006, 06:31 AM
Registered User
Join Date: Oct 2006
Location: Cheltenham, , United Kingdom.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formview with ObjectDataSource

I have come across a problem using the formview with an objectdatasource. When using an object datasource a piece of code like
Button test = (Button)frmvDetails.Controls[0].FindControl("EditButton");
test.Enabled = false;

will generate an error 'Object reference not set to an instance of an object'. Set the formview to reference an SQLDataSource and it is no problem.

I have noticed that if create a new formview and attach it to objectdatasource it will not generate the template code as it does with the SQL code. This is not a problem as it is just a little coding but not being able to reference controls is a problem.

For what I want to do if found the SQLdatasource a problem and the objectdatasource worked really well.

Robert T Turner

  #2 (permalink)  
Old October 31st, 2006, 04:13 PM
Friend of Wrox
Join Date: Feb 2006
Location: , , USA.
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts

I apologize if this is obvious but did you set up the object data source to be able to update by providing it with an update method on your business object to use for that purpose?

I would guess that the formview you are using might not create the Edit button unless it needed it, and so that led me to my guess. Can you post your code?

Neil Timmerman
Veris Consulting
  #3 (permalink)  
Old October 31st, 2006, 04:58 PM
Registered User
Join Date: Oct 2006
Location: Cheltenham, , United Kingdom.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you for your reply.

I rebuilt the page over the weekend and I ave got it working. I do not know why it didn't work before but it was probably somethingsilly that i did or didn't do.

  #4 (permalink)  
Old November 1st, 2006, 06:17 AM
Registered User
Join Date: Nov 2006
Location: bareliiy, up, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

often i havce to face prob server unavaliable tell me the solution to install the .net 2003
i m a beginner and dont knoe the analatical and troublesuting concepe

Similar Threads
Thread Thread Starter Forum Replies Last Post
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
FormView/ObjectDataSource/DropDownList Problem davidanderson ASP.NET 2.0 Professional 3 April 14th, 2007 02:50 AM
Problem with ObjectDataSource... veeruu ASP.NET 2.0 Professional 0 March 2nd, 2007 07:45 AM
ObjectDataSource and Wildcards pipelineconsulting ASP.NET 2.0 Professional 1 October 19th, 2006 09:08 PM
ObjectDataSource control ewhizz ASP.NET 2.0 Basics 1 August 15th, 2006 12:09 PM

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