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 July 22nd, 2006, 01:45 PM
Authorized User
 
Join Date: Jan 2006
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default Autogenerate Formview templates

In this tutorial
http://www.asp.net/learn/dataaccess/....aspx?tabid=63

it says:

">>>> The ItemTemplate can be created by hand (through the declarative syntax) or can be auto-created by binding the FormView to a data source control through the Designer. This auto-created ItemTemplate contains HTML that lists the name of each field and a Label control whose Text property is bound to the field's value. This approach also auto-creates an InsertItemTemplate and EditItemTemplate, both of which are populated with input controls for each of the data fields returned by the data source control.
If you want to auto-create the template, from the FormView's smart tag add a new ObjectDataSource control that invokes the ProductsBLL class's GetProducts() method. This will create a FormView with an ItemTemplate, InsertItemTemplate, and EditItemTemplate. <<<"

I a learning test, I can't get this to autogenerate my FormView templates.

I start with a new form. Add a new FormView. Use the designer in the FormView to select "new data source". Select "Object" as type of datasource. Specify the object datasource.....whirrrrr....no autoformatted templates show up.

I'm using an objectdatasource that just has a select method...it builds a datatable from scratch in memory and returns it. I've used this specific objectdatasource object and method for several other learning tests and it has worked fine so far.

Any suggestions on how to get this autogeneration of FormView templates to work in my test case would be appreciated.

Thanks!
 
Old July 28th, 2006, 12:25 PM
Registered User
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to bluewavestrider
Default

use a gridview

Live in fragments no longer. Only connect.
 
Old July 29th, 2006, 12:09 PM
Authorized User
 
Join Date: Jan 2006
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for post. Formview is chosen so to only see one record at a time. Gridview does not appear to offer autogenerate of template fields, either.

After further research, and no other mention of this capability, I'm concluding that the author of the cited article was incorrect in asserting that FormView had a template autogenerate feature.
 
Old August 1st, 2006, 06:55 PM
Authorized User
 
Join Date: Jan 2006
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It seems to want a strongly typed data table in order to autogenerate the formview templates. It doesn't care whether the strongly typed table comes from a tableadapter or a custom class.

RE-solved!





Similar Threads
Thread Thread Starter Forum Replies Last Post
FormView Question mikener ASP.NET 2.0 Professional 9 September 24th, 2008 05:39 PM
formview mcarol44 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 January 5th, 2008 06:44 AM
Customize autogenerated FormView templates? SpaceWokker ASP.NET 2.0 Basics 2 March 12th, 2007 11:19 AM
how to get autogenerate value for the ID Field MunishBhatia SQL Server 2000 5 December 8th, 2006 03:14 AM
Validation controls and FormView templates bpdsmark BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 September 28th, 2006 08:56 AM





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