Wrox Programmer Forums
BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X
This is the forum to discuss the Wrox book Professional Web Parts and Custom Controls with ASP.NET 2.0 by Peter Vogel; ISBN: 9780764578601
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 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 May 1st, 2006, 03:24 PM
Registered User
Join Date: May 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple constructors for custom controls

Hi! Thank you for reading.

Congratulations for your superb book!

I am just starting with Custom Web Controls. I tried to find how to have multiple constructors for custom controls, but I can't find it on the book...

I developed 2 constructors for my first custom control.
The problem is that ONLY the "default"/no arguments constructor gets called.
I think this happens because I do NOT know how to build my control, the right way, in the ASPX:

For example, when I want to pass arguments p1 and p2, I write what follows in the ASPX and it works, as far as passing the values to public properties named p1 and p2, but won’t call a two parameter constructor.

<prefix:class p1="1" p2="2"></prefix:class>

So, my questions are:
#1) can I have multiple constructors with custom web controls?
#2) if yes, then what should I write in the ASPX, to call a specific constructor?

Thank you so much, for your time and teachings!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Control with Multiple Constructors? three ASP.NET 2.0 Basics 12 May 2nd, 2006 05:29 PM
Custom Controls apry BOOK: Beginning ASP.NET 1.0 2 May 23rd, 2004 11:04 PM
Multiple Constructors Page 194 NUTSHELL BOOK: Beginning Java 2 2 February 5th, 2004 11:00 PM
Custom Controls bmains VS.NET 2002/2003 3 February 5th, 2004 09:54 AM

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