Как мне указать CodeFileBaseClass из web.config?
я1 регистрируюuser control Control
вweb.config
:
<configuration>
<system.web>
<pages validateRequest="false">
<controls>
<add src="~/GenericControls/Toolbar.ascx"
tagName="Toolbar" tagPrefix="Vista" />
</controls>
</pages>
</system.web>
<configuration>
Теперь, потому что мой"user control" этоControl
, а неUserControl
(для поддержки шаблонов), это вызывает ошибку Visual Studio:
ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Исправление этой ошибки заключается в том, что выдолжен напомнить Visual Studio, что * элемент управленияinherits from
Control`:
<%@ Page language="c#" Inherits="University.AspNet.Index"
CodeFile="Index.aspx.cs" CodeFileBaseClass="XXXXXX" %>
с супер-секретомCodeFileBaseClass
приписывать. За исключением того, что я не используюPage директива, я регистрирую элемент управленияsite-wide в веб-конфиге:
<add src="~/GenericControls/Toolbar.ascx"
tagName="Toolbar" tagPrefix="Vista" />
Как мне указатьCodeFileBaseClass
изнутриweb.config
?
Этот вопрос один из текущих серий Stackoverflow,"Templating user controls":
How to add a Templating to a UserControl? How to inherit from Control, rather than UserControl? UserControl has IsPostBack, but Control does not UserControl does not have public property named ContentTemplate How do i specify CodeFileBaseClass from web.config?