How do I create my own ASP.NET control with a dash in the name?

I want to set up an ASP.NET custom control such that it has its own name, specifically with a hyphen inside it, so in markup it might look like this:

<rp:do-something runat="server" id="doSomething1" />
      

I don't mind if this syntax requires customizing the tag mapping in the web.config or something, but the tagMapping element is not exactly what I would like to do.

+1


source to share


2 answers


I would not have thought that this is possible due to the restrictions on the cemetery. I do not believe that you can refer to a control class in markup without referencing it by name



Is there a specific reason why you need a hyphen?

+1


source


John, you're right. I did some searches in Reflector and it looks like it is not getting:
Type ITagNameToTypeMapper.GetControlType(string tagName, IDictionary attribs)
{
    string str;
    string str2 = this._nsRegisterEntry.Namespace;
    if (string.IsNullOrEmpty(str2))
    {
        str = tagName;
    }
    else
    {
        str = str2 + "." + tagName;
    }
    if (this._assembly != null)
    {
        Type type = null;
        try
        {
            type = this._assembly.GetType(str, true, true);
        }

      

Implemented in System.Web.UI.NamespaceTagNameToTypeMapper, System.Web.



@Jonathan: I have a specific business reason for wanting to do it this way. Oh good.

+1


source







All Articles