Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use an empty TagPrefix with a <%@ Register %>

Tags:

c#

.net

asp.net

Though I can successfully do this at the top of a page:

<%@ Register TagPrefix="me" Namespace="MyNamespace" %>

and then use a class like this later:

<Usercontrol:DataRowTextBox ...>
    <Regexes>
        <me:RegularExpressionValidatorItem Type="USPhoneNumber" />
        <me:RegularExpressionValidatorItem Type="InternationalPhoneNumber" />
    </Regexes>
</Usercontrol:DataRowTextBox>

I really would like to do this:

<%@ Register TagPrefix="" Namespace="MyNamespace" %>

so that I can use it like this later:

<Usercontrol:DataRowTextBox ...>
    <Regexes>
        <RegularExpressionValidatorItem Type="USPhoneNumber" />
        <RegularExpressionValidatorItem Type="InternationalPhoneNumber" />
    </Regexes>
</Usercontrol:DataRowTextBox>

but that gives me the error:

The 'tagprefix' attribute cannot be an empty string.

Isn't there a way to register an empty TagPrefix so it can be used globally without that prefix?

The same concept, if I can get it right, would then apply to the Usercontrol prefix too hopefully.

like image 461
Mike Perrenoud Avatar asked Nov 13 '22 04:11

Mike Perrenoud


1 Answers

I have looked at the documentation and it does appear that the "tagprefix" attribute is a required, non-empty attribute.

like image 129
Erik Schierboom Avatar answered Nov 14 '22 23:11

Erik Schierboom