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 28th, 2007, 05:03 PM
Authorized User
 
Join Date: Oct 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 6 Templated Controls

When I try to instantiate the "TemplatedCreditCardForm" the application complains that paymentMethodLabel is null. As I understood from the book, if the template is not used, the base "CompositeCreditCardForm" is used. This does not seem to be happening.

 
Old January 31st, 2007, 02:17 PM
Wrox Author
 
Join Date: Aug 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, geomar,

I had no problem running the same page without specifying templates. The CompositeCreditCardForm is used as expected. I did not get the error that you mentioned in your post.

Here is what I did. I removed all the templates from the TemplatedCreditCardForm.aspx page:

<form id="form1" runat="server">
    <custom:TemplatedCreditCardForm ID="ccf"
     OnValidateCreditCard="ValidateCreditCard" runat="server"
     CardholderNameText="Cardholder's Name"
     CreditCardNoText="Credit Card No."
     PaymentMethodText="Payment Method"
     ExpirationDateText="Expiration Date"
     SubmitButtonText="Submit" Font-Bold="true" />

    <br /><br />
    <asp:Label runat="server" ID="info" />
 </form>

Regards,
Shahram



-----------------------
Shahram Khosravi, Ph.D.
Author of Professional ASP.NET 2.0 Server Control and Component Development
 
Old February 3rd, 2007, 07:58 PM
Authorized User
 
Join Date: Oct 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply. I was typing the code from the text, not the source code. My mistake. In the source code the properties for the labels are overidden. Since I did not override these properties, the labels had not yet been instantiated so a null object error was thrown.

Thanks again.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch.14 Creating Windows Form User Controls problem SAIFI BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 1 September 29th, 2008 05:51 AM
Chapter 6: Templated Controls In Design View geomar BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 1 February 20th, 2007 12:23 PM
Mobile controls setup ch 25 jeffl BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 October 13th, 2006 10:12 PM
Access templated controls properties tony_j_hug ASP.NET 2.0 Basics 5 October 17th, 2005 10:44 AM
Ch. 13/14 creating own custom controls...problem.. Chimlim BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 August 10th, 2005 04:21 AM





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