I try to set Loginstatus logintext by using dictionary item via code behind. I created a macro in master template using a usercontrol like in the following.
This is because, after you login, the control wille display/ the LoggedInTemplate, and not the AnonymousTemplate. So the LoginStatus1 control, which resides in the AnonymousTemplate, is not availabl in login mode.
I guess something like the following should solve your issue:
protectedvoidPage_Load(object sender,EventArgs e) { var ls =LoginView1.FindControl("LoginStatus1") as LoginStatus; if (ls != null) ls.LoginText= umbraco.library.GetDictionaryItem("Login"); }
Multilingual LoginStatus control
I try to set Loginstatus logintext by using dictionary item via code behind. I created a macro in master template using a usercontrol like in the following.
in code-behind
So far so good, I am able to change loginstatus text. Moreover on login page, if you would ever try to log-in, I get
Object reference not set to an instance of an object.
Hello,
This is because, after you login, the control wille display/ the LoggedInTemplate, and not the AnonymousTemplate. So the LoginStatus1 control, which resides in the AnonymousTemplate, is not availabl in login mode.
I guess something like the following should solve your issue:
Cheers,
Michael.
Hi Michael,
This is how I made it work. Thanks for the feedback
The key was indedd the check in null ;-)
Glad you got it working!
Cheers,
Michael.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.