Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 28th, 2007, 05:03 PM
Authorized User
Points: 83, Level: 1
Points: 83, Level: 1 Points: 83, Level: 1 Points: 83, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , , .
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.

  #2 (permalink)  
Old January 31st, 2007, 02:17 PM
Wrox Author
 
Join Date: Aug 2006
Location: , , .
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
  #3 (permalink)  
Old February 3rd, 2007, 07:58 PM
Authorized User
Points: 83, Level: 1
Points: 83, Level: 1 Points: 83, Level: 1 Points: 83, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , , .
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.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.