There is a page Login.aspx having a Label control as "Lbl_LoginExpired". There is also a MasterPage. I want to change the text of "Lbl_LoginExpired" from within the Master Page. How can i achieve this?
Note: 1) Login.aspx is NOT a Content page.
2)
Label label1=new (Label)Login.FndControl("Lbl_LoginExpired")
is NOT working in MasterPage.
If there is no master page- content relationship between these 2 pages. I think your options are limited. Also i am assuming Lbl_LoginExpired is not a part of an user control that you can register in both pages. I would recommend using Session object to pass this information between these 2 pages.
Hence in your master page
Session["expiredtext"] = "Your login has been expired";
And in your login pag check this session value whether it is null or not and show the content of it.
Lbl_LoginExpired.Text=Session["expiredtext"]?.ToString();
Also do not forget to reset (or abonden session when user logs out)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.