Sneha K

Sneha K

  • 1.1k
  • 527
  • 190.1k

How to Get sessionStorage.getitem in ahref in razor view mvc?

Nov 9 2020 4:25 AM
Hi i want to access the sessionStorage.getitem value in my Layout.cshtml.page.First i set value for sessionStoage.Set item in index page.If i move from one page to another page and again i moved to pervious page by clicking home button this session value is not maintained.
Index page
function GetAll() {
sessionStorage.setItem("CommonTypeval", typeval);
}
My code
<li class="nav_menu_item">
var elecval = Session["CommonTypeval"].ToString(); ;
<a onclick='window.location =" @Url.Action("Index", "Home", new { eletype = elecval }) ";' ><i class="fa fa-home"></i><span class="nav_menu_item_text"> Home </span><span class="fa fa-chevron-right"></span></a>
Any one understand my issue and help me to resolve this

Answers (6)