我正在尝试在代码中手动使用我的用户控件,但我看不到用户控件类。
这是我的用户控制:
查看顶部:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CustomerTable.ascx.cs"
Inherits="Controls_CustomerTable" ClassName="CustomerTable" %>
<%@ Register Src="~/Controls/DynamicList.ascx" TagName="Control" TagPrefix="DynamicList" %>
代码:
/// <summary>
/// customer presantation
/// </summary>
public partial class Controls_CustomerTable : System.Web.UI.UserControl
{
/// <summary>
/// The customer for this control
/// </summary>
private Customer customer;
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// Getter and setter for the customer
/// </summary>
private Customer Customer
{
get
{
return this.customer;
}
set
{
this.customer = value;
showCustomer();
}
}
/// <summary>
/// Show the customer details
/// </summary>
private void showCustomer()
{
//set customer details
customerName.InnerText = customer.name;
description.InnerText = customer.shortDescription;
clientIntrest.List = customer.interstedParties;
clientUsers.List = customer.users;
}
}
这是在我的页面中:
查看顶部:
代码:
正如您所看到的那样,它无法得到认可......
答案 0 :(得分:2)
请注意您如何定义班级:
public partial class Controls_CustomerTable
以及您如何尝试使用它:
CustomerTable table
类名不能接近,它们必须准确。您需要以全名引用该类:
Controls_CustomerTable table