Session and CSS

  • Thread starter Thread starter Filip
  • Start date Start date
F

Filip

Hi,
Just started with ASP.NET and C# so I'm testing things I currently use in
standard ASP.
I have a login page which talks to a validation page via XMLHTTP
(implemented in JavaScript on the client side) Based on the response I know
if the user sucessfuly logged in or not. The validation page also sets up
some session variables for me. If they did log in, I hide my login area of
the page using CSS style=display:none;
Now if the user just refreshed the page they will see the login area unless
I supress it.
In classic ASP I do this:

<% if Session("Validated")="true" then
Response.Write "<div style=""display:none;"">"
else
Response.write "<div>"
%>
...... more code
</div>

Now, how do I implement this in ASP.NET
So far I haven't been able to find any articles on this.
Thanks in advance
 
Give your div an id and run at server
<div id=MyDiv runat=server>

if(Session["Validated"].ToString()=="true")
MyDiv.Style["display"]="none";
 
Thanks

DWinter said:
Give your div an id and run at server
<div id=MyDiv runat=server>

if(Session["Validated"].ToString()=="true")
MyDiv.Style["display"]="none";

Filip said:
Hi,
Just started with ASP.NET and C# so I'm testing things I currently use in
standard ASP.
I have a login page which talks to a validation page via XMLHTTP
(implemented in JavaScript on the client side) Based on the response I know
if the user sucessfuly logged in or not. The validation page also sets up
some session variables for me. If they did log in, I hide my login area of
the page using CSS style=display:none;
Now if the user just refreshed the page they will see the login area unless
I supress it.
In classic ASP I do this:

<% if Session("Validated")="true" then
Response.Write "<div style=""display:none;"">"
else
Response.write "<div>"
%>
..... more code
</div>

Now, how do I implement this in ASP.NET
So far I haven't been able to find any articles on this.
Thanks in advance
 
Back
Top