问题描述
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SelectorControl.ascx.cs" Inherits="SelectorControl" %>
然后我可以在任何.aspx中注册该控件并使用,就像这样
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="Folderdistribution.aspx.cs"
Inherits="SearchFolder.Folderdistribution" %>
<%@ Register TagPrefix="UC" TagName="TemplateSelection" Src="~/Controls/SelectorControl.ascx" %>
<div>
<UC:TemplateSelection ID="templates" runat="server" />
</div>
但是,我需要在UserControl(ascx)中设置 CodeFile ,而不是 CodeBehind 。在控制指令中,我更改了
CodeBehind="SelectorControl.ascx.cs"
至CodeFile="SelectorControl.ascx.cs"
The base class includes the field 'templates',but its type (TemplateSelection) is not >compatible with the type of control (ASP.controls__templateselection_ascx).
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)