当前位置:编程学习 > C#/ASP.NET >>

救啊,在动态创建控件时可以调试发布网站时报“ASP”中不存在类型或命名空间名称 的错

发布时居然报了这个错,说明ASP这个命名空间没有引用进来

错误 3 命名空间“ASP”中不存在类型或命名空间名称“teamListl”(是缺少程序集引用吗?) E:\wozuji\Web\userFrist.aspx.cs 83 33 E:\wozuji\Web\

 

请高人帮忙解答下

**********************************************************************************************************************

自定义页面代码:

 

**********************************************************************************************************************

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="teamListl.ascx.cs" Inherits="UserControl_teamListl" ClassName="teamListl" %>

<style type="text/css">
    .style1
    {
        width: 43px;
        height: 50px;
    }
    .style2
    {
        height: 50px;
    }
    .style3
    {
        height: 50px;
    }
    .big{ font-size:18px; }
</style>
<div style="width: 494px">
    <table style="width:100%; border-bottomolid 1px;" cellpadding="0" cellspacing="0">
        <tr>
            <td class="style1">
                <asp:Image ID="teamLogo" runat="server" Height="60px" Width="60" />
            </td>
            <td valign="bottom" class="style3">
                <asp:HyperLink ID="teamUrl" runat="server"  CssClass="big" >[teamUrl]</asp:HyperLink>
            </td>
        </tr>
    </table>
</div>


*******************************************************************************************************************

控件cs代码

*******************************************************************************************************************‘

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class UserControl_teamListl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public void setTeamUrl(string teamurlText,string teamTarget)
    {
        teamUrl.NavigateUrl=teamTarget;
        teamUrl.Text=teamurlText;
        
    }
    public void setTeamLogo(string TeamLogoPath)
    {
        teamLogo.ImageUrl = TeamLogoPath;
    }
}


**************************************************************************************************************

页面使用时cs代码

**************************************************************************************************************
 if (teamlist.Contains("|"))
                    {
                        for (int i = 0; i < teamalone.GetUpperBound(0) - 1; i++)
                        {
                            teamone = teamalone.Split(',');
                            ASP.teamListl tmlt;
                            tmlt = (ASP.teamListl)LoadControl("~/UserControl/teamListl.ascx");
                            tmlt.setTeamLogo("../"+teamone[2].ToString());
                            tmlt.setTeamUrl(teamone[1].ToString(), "../myTeam.aspx?id=" + teamone[0].ToString());
                            Panel2.Controls.Add(tmlt);


                        }
                    }
                    else
                    {
                        teamone = teamalone[0].Split(',');
                        ASP.teamListl tmlt;
                        tmlt = (ASP.teamListl)LoadControl("~/UserControl/teamListl.ascx");
                        tmlt.setTeamLogo("../"+teamone[2].ToString());
                        tmlt.setTeamUrl(teamone[1].ToString(), "../myTeam.aspx?id=" + teamone[0].ToString());
                        Panel2.Controls.Add(tmlt);
                    }
                   

--------------------编程问答-------------------- 你自定义页面的代码 是不是直接复制粘贴过去的啊  这样是不行的
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,