Very new to ASP.net and have a very basic question.
I'm trying to figure out how to define a variable (true) at the top of an index.aspx page and then use a conditional statement within a link to tie in an "id="select"" in the link.
Here is the PHP equivalent of what I need to do:
<? $x = 1; ?>
<a href="/about/" <? if($x == 1) echo "id=\"select\"" ?>>about us</a>
Much appreciated!
I'm trying to figure out how to define a variable (true) at the top of an index.aspx page and then use a conditional statement within a link to tie in an "id="select"" in the link.
Here is the PHP equivalent of what I need to do:
<? $x = 1; ?>
<a href="/about/" <? if($x == 1) echo "id=\"select\"" ?>>about us</a>
Much appreciated!
Hi,
I really think you should be doing this from your CodeBehind file - are there any specific reason why you're not doing that?
Anyway, you should be able to do it like this:
I really think you should be doing this from your CodeBehind file - are there any specific reason why you're not doing that?

Anyway, you should be able to do it like this:
<%
bool test = true;
%>
<a href="/About/"<% if(test) Response.Write(" id=\"selected\""); %>>Test</a>