문제

I have a property in asp.net application

ABPS.PRR.WEB.CurrentSession.Theme

and I'm setting it in @Page directive in aspx pages like:

<%@ Page StylesheetTheme="ABPS.PRR.WEB.CurrentSession.Theme"  Title="Default" ... %>

but I'm getting runtime error

Parser Error Message: Theme 'ABPS.PRR.WEB.CurrentSession.Theme' cannot be found in the application or global theme directories.

How can I implement this in page directive?

도움이 되었습니까?

해결책

StylesheetTheme requires a theme name and you are supplying this in the wrong way.

If you want to set the theme at runtime then you need to store it in a session variable, you can do it like...

protected void Page_PreInit(object sender, EventArgs e)
{
    Page.StylesheetTheme = ABPS.PRR.WEB.CurrentSession.Theme;
}

다른 팁

If you want to set other value to the StyleSheetTheme property of a page, you'll need to override it:

public override string StyleSheetTheme
{
    get
    {
        return ABPS.PRR.WEB.CurrentSession.Theme;
    }
    set
    {
    }
}

But if you want to change the Theme property, just set its value in the Page_PreInit event:

protected void Page_PreInit(object sender, EventArgs e)
{
    this.Theme = ABPS.PRR.WEB.CurrentSession.Theme;
}

You could set it in the code.

Put this in the Page_PreInit method.

Page.Theme = ABPS.PRR.WEB.CurrentSession.Theme

or

Page.StyleSheetTheme = ABPS.PRR.WEB.CurrentSession.Theme
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top