I have been stuck for several days already. I desperately need some
help.

I am using Asp.Net 2 and VS2005.  I am using a TreeView control and am
trying to get a click event from a SAME-NODE click event which isn't
supported by TreeView.  So I create a custom control (inherited
control) from TreeView.  But I can seem to get it work. There is no
compilation error. But when I run it, I got the following error.

Description: An error occurred during the parsing of a resource
required to service this request. Please review the following specific
parse error details and modify your source file appropriately.

Parser Error Message: Unknown server tag
'mycontrol:WebCustomControl1'.


I register it as:

<%@ Register Namespace="CustomControls" TagPrefix="mycontrol"%>

and use it in my aspx page like this:

=======================================================
<mycontrol:WebCustomControl1 id="m_LeftTree" runat="server"

OnSelectedNodeChanged="OnLeftMenuClicked"

DataSourceID="m_XmlDataSourceTreeView" NodeIndent="10" SkipLinkText=""
CssClass="minorSpace1" >

 ......

</mycontrol:WebCustomControl1>
============================================================

The custom control code is extremely simple. I just added from the IDE
and change the base class to TreeView, so I haven't added any
functionality. Here it is:

======================================================

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Text;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace CustomControls

{

[DefaultProperty("Text")]

[ToolboxData("<{0}:WebCustomControl1 runat=server></
{0}:WebCustomControl1>")]

public class WebCustomControl1 : System.Web.UI.WebControls.TreeView

{

[Bindable(true)]

[Category("Appearance")]

[DefaultValue("")]

[Localizable(true)]

public string Text

{

get

{

String s = (String)ViewState["Text"];

return ((s == null) ? String.Empty : s);

}

set

{

ViewState["Text"] = value;

}

}

protected override void RenderContents(HtmlTextWriter output)

{

output.Write(Text);

}

}

}

Reply via email to