Setting passwordhints;
using (var db = new dbDataContext())
{
passwordhints = (from c in db.Settings
where c.Name == "ShowPasswordHints" && c.ID == _ID
select c).FirstOrDefault();
}
if (passwordhints != null)
ViewData["ShowPasswordHints"] = passwordhints.Value;
else
ViewData["ShowPasswordHints"] = "False";
is in the controller, when I get to the page itself, I output
<%=ViewData["ShowPasswordHints"]%> in the title tag, and I see it where it says “True” (without the quotes, I also checked the spaces by surrounding it with a bracket, and there are no spaces literally just True)
However when i do
<%if(ViewData["ShowPasswordHints"] == "True") {%> SHOW THIS <%}%>
SHOW IT never appears, what the hell?
The UPDATE . However, if ViewData is set like this: IT WORKS ... HUH ??
if (accountRepository.isLDAPEnabled(_ID))
ViewData["LDAP"] = "True";
else
ViewData["LDAP"] = "False";
view...
<%if(ViewData["LDAP"] == "True"){ %>
SHOW THIS
<%} %>
THANKS EVERYONE HERE IS A NEW METHOD WHICH WORKS BIG
ViewData["something"] = true;
<%if(true.Equals(ViewData["something"])){%> SHOW THIS <%}%>
source
share