Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

C# if else problem


  • Please log in to reply

#1
GinaB

GinaB

    New Member

  • Member
  • Pip
  • 7 posts
Hello,

I am new to C# I can not seem to see what the problem is with my if, if else statement....

Does anyone tell me what is off?


<% If (Session["Level"] == "NONE")%>
<!-- <tr> -->
<!-- <td align=right><img src="../images/Seasonal/Vday/happyVday.gif" ></td> -->
<!-- <td align=right><img src="../images/Seasonal/Vday/animated_1.gif"></td> -->
<!-- <td align=Center><img src="../images/Seasonal/StPatDay/happy st pat day 2.jpg"></td> -->
<!-- </tr> -->

</table>
</div>
<% If (Session["Level"] != "NONE")%>


<!-- Add the Menu -->

<script language='JavaScript' src='Includes/Menu.js' type='text/javascript'></script>

<script language='JavaScript'>menuMain("<% =Session("Level") %>", "<% =Session("LoginID") %>");</script>
<%;
else%>

<!-- Add Home and Logout links -->
"<span onmouseout="this.style.backgroundColor='#717171'" onmouseover="this.style.backgroundColor='#b9b9b9'"
style="position: absolute; left: 800px; top: 61px; height: 24px; color: #FFFFFF;
width: 90px; text-align: center;">
<a class="itemText" href="http://korhmfps06/NE...e/HomePage.asp" style="color: #FFFFFF;">
Home Page</a>
</span>
<span onmouseout="this.style.backgroundColor='#717171'" onmouseover="this.style.backgroundColor='#b9b9b9'"
style="position: absolute; left: 890px; top: 61px; height: 24px; color: #FFFFFF;
width: 90px; text-align: center;">
<a class="itemText" href="http://korhmfps06/NE...?Action=Logout" style="color: #FFFFFF;">
Logout</a>
</span>
<%;%>

thanks so much
  • 0

Advertisements


#2
Hai Mac

Hai Mac

    Member

  • Member
  • PipPipPip
  • 260 posts
Hello GinaB,
I am not quite sure what you mean, because I can't see any C# code in your post...
  • 0

#3
destin

destin

    Member

  • Member
  • PipPip
  • 53 posts

Hello GinaB,
I am not quite sure what you mean, because I can't see any C# code in your post...

Yeah, looks like Javascript to me.. but hey, what do I know?
  • 0

#4
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 1,382 posts
It seems to me that your using C# on ASP.NET and your using the code-render programming model(i.e typing C# code inside code-render tags("<% %>") with the rest of the html code).
But, then again I'm not sure because I see that your file extension is .asp and not .aspx.
If my intial presumptions are correct, then look at the following line:
<% If (Session["Level"] == "NONE")%>
C# is case-sensitive and If statements shoud have a lower-case i, i.e is should be:
<% if (Session["Level"] == "NONE")%>

Not getting full compiler support from the C# complier is one of the dis-advantages of the code-render model, why don't you use the code-behind model, i.e. seprating C# and asp.net\html code.

Edited by darth_ash, 15 March 2006 - 12:45 AM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP