Page
에서 상속받은 _Default
클래스 내에서 Page_PreInit
함수를 재정의하려고합니다. 여기 Page_PreInit를 재정의 할 때 컴파일러 오류가 발생했습니다.
내 코드입니다 : 내가 컴파일 할 때, 나는 다음과 같은 오류가 발생합니다'_Default.Page_PreInit(object, System.EventArgs)': no suitable method found to override
public partial class _Default : Page
{
protected override void Page_PreInit(object sender, EventArgs e)
{
// Todo:
// The _Default class overrides the Page_PreInit method and sets the value
// of the MasterPageFile property to the current value in the
// selectedLayout session variable.
MasterPageFile = Master.Session["selectedLayout"];
}
...
}
오 그래, 고마워! 여전히 "개체 참조가 개체의 인스턴스로 설정되지 않았습니다."오류 여기 : MasterPageFile = Master.Session [ "selectedLayout"]; – shenn
'Master.Session' 대신'this.Session'을 시도하십시오. –
this.session이 나타납니다 : 표현식 유형 'method group'에 []을 (를) 적용 할 수 없습니다 – shenn