Wrox Programmer Forums
|
BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Server Control and Component Development by Dr. Shahram Khosravi; ISBN: 9780471793502
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 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 January 9th, 2007, 03:25 AM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default TemplatedCreditCardForm in VisualStudio

Following along with the book in chapter 6, I put the TemplatedCreditCardForm on a web page and in VisualStudio when trying to build the website errors would be displayed like the following:

Error 1 Cannot switch views: Content is not allowed between the opening and closing tags for element 'TemplatedCreditCardForm'.

The errors prevented the page from being displayed in design view. I figured out how to resolve the issue by adding the PersistenceMode attribute to the template properties like so:

        private ITemplate paymentMethodLabelTemplate;
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public ITemplate PaymentMethodLabelTemplate
        {
            get { return paymentMethodLabelTemplate; }
            set { paymentMethodLabelTemplate = value; }
        }

        private ITemplate creditCardNoLabelTemplate;
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public ITemplate CreditCardNoLabelTemplate
        {
            get { return creditCardNoLabelTemplate; }
            set { creditCardNoLabelTemplate = value; }
        }

        private ITemplate cardholderNameLabelTemplate;
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public ITemplate CardholderNameLabelTemplate
        {
            get { return cardholderNameLabelTemplate; }
            set { cardholderNameLabelTemplate = value; }
        }

        private ITemplate expirationDateLabelTemplate;
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public ITemplate ExpirationDateLabelTemplate
        {
            get { return expirationDateLabelTemplate; }
            set { expirationDateLabelTemplate = value; }
        }

Hopefully this will help out others that experience this same issue.
 
Old January 31st, 2007, 02:59 PM
Wrox Author
 
Join Date: Aug 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, oldSkool,
The error you're seeing is a design time error not a compilation and runtime error. In other words, the application should compile and run without any problems.

As you rightly mentioned, the missing PersistenceMode attribute is the cause of this design time error. Thanks for catching this error.

Regards,
Shahram

-----------------------
Shahram Khosravi, Ph.D.
Author of Professional ASP.NET 2.0 Server Control and Component Development





Similar Threads
Thread Thread Starter Forum Replies Last Post
CrystalReport.net VisualStudio 2005 ASP.net (VB) pgkdave Crystal Reports 0 June 16th, 2006 09:39 AM





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