使用带有的空tag前缀

时间:2022-09-12 03:09:43

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.

“tagprefix”属性不能是空字符串。

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

难道没有一种方法来注册一个空的TagPrefix,以便在没有这个前缀的情况下可以全局使用吗?

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

同样的概念,如果我能把它写对,那么也会应用到Usercontrol前缀。

1 个解决方案

#1


1  

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

我已经查看了文档,它确实显示了“tagprefix”属性是必需的非空属性。

#1


1  

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

我已经查看了文档,它确实显示了“tagprefix”属性是必需的非空属性。