[英]Need help on running a ASP.Net project with .ascx file
在過去的兩天里,當我嘗試編譯並運行一個使用用戶控件的現有ASP.net項目時,我付出了很多努力。 我面臨的問題如下
當我嘗試編譯項目時,.ascx文件出現錯誤,無法加載繼承標記部分中定義的類型。 在我的項目中的繼承部分中,像這樣的Inherits =“ UserInfoBoxControl”一樣,在用戶控件名稱之前添加了另一個名稱空間,該名稱空間我在項目中找不到任何位置。 但是我有.ascx代碼文件。要克服這個問題,我能做什么?
下一個問題是在編譯項目時,.ascx文件中出現一些錯誤,但奇怪的問題是,它是從項目的備份文件夾而不是項目主文件夾中獲取用戶控件的代碼文件。我可以在項目中進行更改,以便從項目主文件夾中獲取usercontrol的代碼文件。
.ascx文件的代碼是
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ViewClinic.ascx.cs" Inherits="Tree.Templates.DynamicContent.Vpo.UserControls.ViewClinic" %>
<link type="text/css" href='<%=ResolveUrl("../Styles/StyleSheetVpo1.css")%>' rel="stylesheet" />
<script type="text/javascript" src='<%=ResolveUrl("../Scripts/jquery-1.4.4.js")%>'></script>
<script type="text/javascript" src='<%=ResolveUrl("../Scripts/jquery.tooltip.js")%>'></script>
<script type="text/javascript" src='<%=ResolveUrl("../Scripts/GeneralNEEV.js")%>'></script>
<asp:Repeater ID="rcClinics" runat="server" OnItemDataBound="rcClinics_ItemDataBound" >
<ItemTemplate>
<div id="menu" runat="server" class='FirstMenu'>
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="45%" style="font-size:13px !important;">
<span>
<asp:Label ID="lblCli" runat="server"></asp:Label>
</span>
</td>
<td width="55%" style="font-size:14px !important;">
<span id="spVac" runat="server">0</span>
</td>
</tr>
</table>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
而文件背后的代碼是
namespace Tree.Templates.DynamicContent.Vpo.UserControls
{
public partial class ViewClinic : System.Web.UI.UserControl
{
public VpoParameters VpoParas { get; set; }
private JArray AllClinics = new JArray();
private List<Clinic> clinics;
private List<CareUnit> careUnits;
private List<Total> total;
private int intClinicId = 0;
private int satellite_patient = 0;
private int id = 0;
protected String VpoEditUpdateUrl = System.Configuration.ConfigurationManager.AppSettings["VpoEditUpdateUrl"];
protected List<ColumnInfo> cinfo = new List<ColumnInfo>();
protected String user = "";
CareUnit ava = new CareUnit();
protected int avCuId = 0;
}
謝謝,問候烏塔爾
嘗試右鍵單擊Visual Studio中的備份文件夾,然后選擇“從項目中排除並重建”。 如果存在具有相同名稱空間和類名稱的.cs文件,則它們會發生沖突。 由於您的課程是部分課程,它將嘗試編譯您的備份文件夾,並且可能會失敗
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.