【问题标题】:An error occurred during the compilation of a resource required to service this request4编译服务此请求所需的资源时发生错误4
【发布时间】:2016-03-29 21:17:28
【问题描述】:
**Compilation Error**

说明:在编译服务此请求所需的资源时出错。请查看以下特定错误详细信息并适当修改您的源代码。

编译器错误消息: CS1061:“ASP.marketing_incentives_convention_aspx”不包含“约定”的定义,并且没有接受“ASP.marketing_incentives_convention_aspx”类型的第一个参数的扩展方法“约定”可能是找到(您是否缺少 using 指令或程序集引用?)

我在下面添加了代码

***convention.aspx file code*** 

%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Convention.aspx.cs" Inherits="MidlandAnnuityApps.Marketing.Incentives.Convention" %>

<%@ Register src="Convention.ascx" tagname="Convention" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Convention</title>

</head>
<body>
    <form id="form1" runat="server">
        <div class="AppDiv">
            <div id="ContentDiv"> 
                <uc1:Convention ID="Convention" runat="server" />
            </div>
        </div>
    </form>

    <iframe id="inneriframe" width="10" height="10" scrolling="no" ></iframe>

</body>


<script language="javascript" type="text/javascript" src="/_Template/script/iFrameScripts2.js"></script> 

</html>

***convention.aspx.cs code***

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MidlandAnnuity;

namespace MidlandAnnuityApps.Marketing.Incentives
{
    public partial class Convention : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}

***convention.ascx code***

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Convention.ascx.cs"
    Inherits="MidlandAnnuity.Marketing.Incentives.Convention" %>
<style type="text/css">
    a:hover
    {
        color: #565555;
    }
</style>
<table width="600" cellpadding="0" cellspacing="0" border="0" align="center">
    <tr>
        <td colspan="2">
            <img src="https://www.agentcertification.com/HostedImages/19541Images/BudapestHeader.jpg"
                alt="Missing Image" width="600" height="188" />
        </td>
    </tr>
    <tr>
        <td width="313" align="center">
            <img src="https://www.agentcertification.com/HostedImages/19541Images/BudapestLogo.jpg"
                width="300" height="175" />
        </td>
        <td width="287" align="center" valign="middle" bgcolor="#FFFFFF" class="links" style="padding: 10px;
            font-family: Arial, Helvetica, sans-serif; font-size: 12pt;">
            <p>
                <strong>Your Production Credits</strong>
            </p>
            <p align="center">
                <span style="font: bold 12pt arial,helvetica,sans-serif;">
                    <asp:Label ID="lblConventionCredits" runat="server"></asp:Label></span>
            </p>
            <p align="center" style="font: 10pt arial,helvetica,sans-serif;">
                    <a href="http://sfgmembers.wistia.com/medias/tyr5ydk7d3" target="_blank">
                        <img src="https://www.agentcertification.com/HostedImages/19541Images/BudapestVideo.jpg"
                            width="200" height="114" alt="Budapest Video" /></a>
                    <p style="font-size: 10pt; color: #000000">
                        <a href="http://sfgmembers.wistia.com/medias/tyr5ydk7d3" target="_blank">Watch this
                            video for a preview of all<br />
                            you'll experience in Budapest! </a>
                    </p>
                </p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 11pt;
            padding-left: 20px; padding-right: 20px;">
            <p>
                <br />
                A truly extraordinary experience awaits those who qualify for Midland National Annuity
                Division 2016 Agents’ Convention at the<a href="http://www.fourseasons.com/budapest/"
                    target="_blank"> Four Seasons Hotel Gresham Palace Budapest</a>. <strong>You'll create
                        memories to last a lifetime.</strong></p>
            <p style="font-size: 12pt; color: #7C1C1E;">
                <strong>May 20-24, 2016 - Main Convention</strong> <span style="font-size: 10pt;">(Gold,
                    Platinum and Diamond Levels)</span><br />
                <strong>May 18-20, 2016 - Platinum and Diamond Levels</strong></p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 11pt;
            padding-left: 20px; padding-right: 20px;">
            <p style="font-size: 13pt; color: #e38806; font-style: italic;">
                <strong>Celebrate the Past. Embrace the Future.</strong></p>
            <p style="font-size: 11pt;">
                Celebrate the past as you enjoy the panoramic views from the famous Fishermen's
                Bastion and explore the cobblestone streets of the Buda Castle District. Embrace
                the future while indulging in Budapest's unexpected elegance, ultra-modern accommodations,
                and delightful cuisine.
                <br />
                <br />
                With its quaint culture, remarkable markets, magnificent architecture and talks
                of a tumultuous history, Budapest is a city like no other. You'll create memories
                to last a lifetime...<strong>Budapest in 2016</strong>!</p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 11pt;
            padding-left: 20px; padding-right: 20px;">
            <p style="font-size: 13pt; color: #e38806; font-style: italic;">
                <strong>To Qualify</strong></p>
            <p>
                Qualification for the convention is based on eligible business issued between
                <br />
                January 1, 2015 and December 31, 2015. For more information, view our complete <a
                    href="https://www.midlandnational.com/group/mnportal/an-convention-qualification"
                    title="Convention Qualification Details" target="_blank">Qualification Details.</a></p>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 8pt;
            color: #333333; padding: 20px;">
            <strong>FOR AGENT USE ONLY. NOT TO BE USED FOR CONSUMER SOLICITATION PURPOSES.</strong><br />
            19541Y-HTML | REV 2-15
        </td>
    </tr>
</table>
<script language="javascript" type="text/javascript" src="/_Template/script/iFrameScripts2.js"></script>

***convention.ascx.cs code***

using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Globalization;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml;
using MidlandAnnuityApps.wsAnnuityAgent;
using log4net;
using log4net.Config;

namespace MidlandAnnuity.Marketing.Incentives
{
    public partial class Convention : ControlBase
    {
        protected System.Web.UI.WebControls.Label lblConventionCredits;
        private static ILog log = LogManager.GetLogger("ErrorLog");
        private static ILog infoLog = LogManager.GetLogger("InfoLog");

        protected void Page_Load(object sender, EventArgs e)
        {
            // Put user code to initialize the page here
            UserContext u = ((PageBase)Page).CurrUser;
            infoLog.Info(String.Format("Convention.ascx IsHomeOffice: {0}, IsImpersonationActive: {1}", u.IsHomeOffice, u.IsImpersonationActive));
            if (u.IsHomeOffice && u.IsImpersonationActive == false)
            {
                lblConventionCredits.Text = "0 - No Agent Emulated";
            }
            else
            {
                MidlandAnnuityApps.wsAnnuityAgent.AnnuityAgent svc = new MidlandAnnuityApps.wsAnnuityAgent.AnnuityAgent();
                string xml_data = svc.GetPremierClub(u.TIN);
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml_data);
                lblConventionCredits.Text = TryParse(doc.DocumentElement.GetAttribute("ConventionCredits"));
            }
        }

        private string TryParse(string number)
        {
            decimal x = -1;
            try
            {
                x = decimal.Parse(number);
                return (x.ToString("###,###,##0"));
            }
            catch
            {
                return (number);
            }
        }
    }
}

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    我认为你有命名冲突,将 ID 更改为:

    ID="ConventionControl"
    

    然后将代码隐藏中的引用修复为 ConventionControl...您将控件名称和 ID 都设置为 Convention,我认为这在这里是冲突的。

    【讨论】:

      猜你喜欢
      • 2016-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-09
      相关资源
      最近更新 更多