Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 February 16th, 2005, 10:05 AM
Authorized User
 
Join Date: Nov 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default My Custom Control Fails to Load

EDIT: Working user control version (with ascx file, which I want to avoid) can be downloaded from :
http://www.codeproject.com/aspnet/DHTMLMenuASPNET.asp

-------------------------------------------------

I've been writing a custom control that is a CSS-DHTML menu implementation (original CSS, javascript part written by Sylvain Machefert). I made it work perfectly as a user control (with ascx page and its code page), then I wanted it to be purely code to make it available just by moving it's dll. Also in this new version I wanted that some parameters available as child-controls to my menu control, therfore look of DHTML menu can be different in every page it's implemented by simply changing few words in codepage.
It didn't work. For my "menu" and it's child-control (paramControl) I created an empty class project, changed the code as needed (more on that in paragraphs below) and builded with no errors. Then I created a test web project, with one aspx page. I added my "menu" project to my test page solution, and added my assembly to "References" of test page project. I also registered my menu custom control at the top of aspx page:
<%@ Register TagPrefix="CSSMenu" Namespace="CSSMenu" Assembly="menu"%>
It gave me "Could not load type CSSMenu.menu from assembly menu" error, showing line of
<CSSMenu:menu id="Menu1" runat="server"> line in red. After few tries to make it work now I get "?" for parser error message. No code changed actually. It's very frustrating.

Here are the things I did to port my user control to child control parsing pure code version:

1) I changed inherits System.Web.UI.UserControl to Control in order to make it easier for child control parsing.

2) Because there is no ascx page which contains a litteral control that I was filling with menu's html code now, I wrote an overriden render method. All menu code to be in HTML kept in a string which becomes parameter of Output.Wrtite method (Output as you might guess is HtmlTextWriter input of render method).

3) Also for -1- to work I added "Page." in front of all Session variables calls.

4) I added property parameterControls ArrayList and wrote the code below to make paramControl class that has key and value properties for menu parameters:
        Protected Overrides Sub AddParsedSubObject(ByVal Obj As Object)
            If (TypeOf Obj Is paramControl) Then
                _parameterControls.Add(Obj)
            End If

        End Sub

5) In page_load method of menu control I added for loop below to read parameters:
                For i As Integer = 0 To _parameterControls.Count - 1
                    Dim paramDummy As paramControl = CType(_parameterControls(i), paramControl)
                    Select Case paramDummy.Key
                        Case "cssFile"
                            cssFile = paramDummy.Value
                    End Select
                Next

Basicaly I guess this is all the information that matters.

Any help would be appreciated.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Server Control....Custom Property Editor ZArrinPour ASP.NET 1.0 and 1.1 Basics 1 June 15th, 2010 11:30 AM
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
Login Control fails on server PeterX ASP.NET 2.0 Basics 0 July 25th, 2006 10:53 AM
Help! Custom Server Control using User Control diehard ASP.NET 1.0 and 1.1 Professional 2 January 4th, 2006 12:33 PM





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