0
我有一个使用asp.net构建的网站。无法投入'ASP.MyControlName_ascx'类型的对象来键入'MyControlName'
在我的本地电脑这工作正常。但我这个部署在服务器上后,我得到了以下错误味精当我尝试去到一个页面
--Data--System.Collections.ListDictionaryInternal--Base Exception--System.InvalidCastException: Unable to cast object of type 'ASP.uc_eventmanagment_skill_skillbind_ascx' to type 'HRMS.uc.Skill.SkillBind'.
at HRMS.Task.LoadAdminPanels(String page)
at HRMS.Task.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)--Inner Exception--System.InvalidCastException: Unable to cast object of type 'ASP.uc_eventmanagment_skill_skillbind_ascx' to type 'HRMS.uc.Skill.SkillBind'.
at HRMS.Task.LoadAdminPanels(String page)
at HRMS.Task.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)--Source--System.Web--StackTrace-- at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
加载ASCX文件我用这个代码
SkillBind SkillBind = (SkillBind)LoadControl("/uc/EventManagment/Skill/SkillBind.ascx");
SkillBind.ID = "SkillBind";
pHolderContainer.Controls.Add(SkillBind);
的哪些错误?
您在使用'Page.LoadControl'加载'skillbind' ASCX控制?显示更多详细信息,包括代码背后的ASCX和ASPX页面标记。 –
@TetsuyaYamamoto嗨朋友更新了这个问题 –