asp.netを使用して作成したWebサイトがあります。'ASP.MyControlName_ascx'タイプのオブジェクトを 'MyControlName'にキャストできません
私のローカルPCでこれは正常に動作します。私は、サーバー上でこれを展開した後、私はこのコード
SkillBind SkillBind = (SkillBind)LoadControl("/uc/EventManagment/Skill/SkillBind.ascx");
SkillBind.ID = "SkillBind";
pHolderContainer.Controls.Add(SkillBind);
いただきまし間違っを使用していますASCXファイルをロードするためのページ
--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)
に行くしようとすると、しかし、私はエラーMSGを次しまいましたか?
あなたは 'skillbind' ASCXコントロールをロードするために、' Page.LoadControl'を使用していますか? ASCXとASPXのページマークアップも含め、コードの背後にある詳細を表示してください。 –
@TetsuyaYamamotoこんにちは友人が質問を更新しました –