Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 April 1st, 2004, 03:27 PM
Authorized User
 
Join Date: Dec 2003
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default Declare Custom Control in Code-Behind File

Good afternoon,

I created a custom control, compiled it into a DLL, and added it to the BIN directory. I placed an instance of the control in a webForm and am trying to programatically change its properties via the Page_Load subroutine in a code-behind file. Can someone please tell me the proper procedure for declaring the new custom control in the code-behind file?

I will be happy to provide all of the code (DLL, ASPX, and ASPX.VB) to anyone who is able to assist.

Thank you in advance.

I am getting the following error:
Parser Error Message: The base class includes the field 'ctrlShowColor', but its type (learn.myControls.ShowColor) is not compatible with the type of control (myControls.ShowColor).


Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.DolphinBay.biz
 
Old April 2nd, 2004, 12:30 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It sounds like the problem with this is a lack of a root namespace. If the DLL is being compiled on the command line, you need to specify a root namespace.

/rootnamespace:<string>

You probably want this: /rootnamespace:learn

This way, "myControls" will live underneath the "learn" namespace and the control types will match up correctly.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old April 2nd, 2004, 09:49 AM
Authorized User
 
Join Date: Dec 2003
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default

Peter thank you for the response. Would I use this "flag" as part of the command line when compiling? For instance

vbc /t:library /r:system.dll,system.web.dll TestControl.vb

would now become

vbc /namespace:something /t:library /r:system.dll....

Thank you again for your time and assistance.


Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.DolphinBay.biz
 
Old April 3rd, 2004, 07:34 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Yes. That way any class/namespace that lives in the code you are compiling to that assembly will live under the namespace you specify.

Compile with root namespace "learn". For code that looks like this:

Namespace myControls
   Public Class ShowColor
      ...
   End Class
End Namespace

The full name of the ShowColor class will be "learn.myControls.ShowColor".





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service, Custom Control, Custom Return Type robzyc ASP.NET 2.0 Basics 6 June 10th, 2008 08:03 AM
custom control inside custom control issues StevesonD ASP.NET 2.0 Professional 1 February 19th, 2008 06:54 PM
File not found error- custom control Sheraz Khan ASP.NET 2.0 Professional 8 September 28th, 2007 03:54 PM
Adding code to a button inside a custom Control. Roinka ASP.NET 2.0 Basics 5 April 23rd, 2006 01:03 PM
Set Custom Control Properites in Code-Behind DolphinBay ASP.NET 1.0 and 1.1 Basics 1 April 3rd, 2004 08:35 PM





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