c# - If property at session not null or default value, run/print javascript Razor ASP.NET MVC -


how print javascript when accessing model session , property value not empty @ razor?

this code:

@{ arm.models.lanidmodel lanidmodel = (lanidmodel)httpcontext.current.session["sesslanidmodel"]; }}   @if(lanidmodel.lanid!=0 && lanidmodel.name != string.empty &&  !string.isnullorempty(lanidmodel.email)){            @html.raw("$('.input-switch-disabled').removeattr('disabled');");         } 

and when run on browser, got this:

 @if(lanidmodel.lanid!=0 && lanidmodel.name != string.empty && !string.isnullorempty(lanidmodel.email)){ line 98:            @html.raw("$('.input-switch-disabled').removeattr('disabled');"); line 99:         } 

is able do?

wrap javascript in script tags.

@html.raw("<script>$('input-switch-disabled').removeattr('disabled');</script>"); 

Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -