ASP:面板RUNAT ="服务器"在C#中的.cs code页面不可用 [英] asp:Panel runat="server" not available in C# .cs code page

查看:127
本文介绍了ASP:面板RUNAT ="服务器"在C#中的.cs code页面不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ascx页:

<%@ Control Language="c#"  Inherits="FSB.Layouts.Short_Home_Loan_Application" CodeBehind="Short Home Loan Application.ascx.cs" %>    
<div class="form">
<form action="" method="post" rel="shortForm">
    <div class="section">        
         <asp:panel id="shortForm_wrapper" runat="server">
            this is the first panel
         </asp:panel>
         <asp:Panel runat="server" ID="thankYouWrapper" >this is the second panel</asp:Panel>
    </div>     
</form>
</div>

<sc:sublayout runat="server" path="~/layouts/FSB/Document Checklist Lightbox.ascx" id="checklist" />

我的CS页:

using System;
using Sitecore.Data.Items;
using Sitecore.Links;
using Sitecore.Data.Fields;
using Sitecore.Web.UI.WebControls;
using System.Net;
using FSB.Helpers;
using System.Configuration;
using System.Text;
using System.Web;
using System.Web.SessionState;

namespace FSB.Layouts {

    public partial class Short_Home_Loan_Application : System.Web.UI.UserControl {    

        protected void Page_Load(object sender, EventArgs e) {
            thankYouWrapper // not accessible here
        }
    }
}

注意:这是一个CMS项目,并使用Sitecore的。我真的不知道这是可能是什么这有助于。我完全新的C#,并已扔进一堆C#的网站。

NOTE: This is a CMS project and uses Sitecore. I don't actually know what it is may be this helps. I am totally new to C# and have been thrown into bunch of C# websites.

在此先感谢

推荐答案

我假设你有一个Web应用程序项目,而不是一个网站项目。因此,在解决方案资源管理器,浏览到您的 *。ASCX 文件,展开它看到了C#code-背后,你也将看到 *。ascx.designer.cs 文件。删除设计师的文件。接下来,在你的 *。ASCX右键单击文件,并选择转换为Web应用程序这将重新生成设计文件。现在尝试访问通过C#控制。

I assume you have a Web Application Project instead of a WebSite Project. As such, in the Solution Explorer, navigate to your *.ascx file, expand it to see the C# code-behind and you will also see a *.ascx.designer.cs file. Delete that "designer" file. Next, right-click on your *.ascx file and select Convert to Web Application which will re-generate the designer file. Now try to access the control via C#.

这篇关于ASP:面板RUNAT =&QUOT;服务器&QUOT;在C#中的.cs code页面不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆