c# - How to write IF ELSE statements in ASP.NET inside document? -


i'm having problem using if statements in asp.net c# html documents.

i want below in php, in asp.

<?php if(1==1){ ?>   <h1>hellow world!</h1> <?php }else{ ?>   <h1>bye world!</h1 <?php } ?> 

how do this?

the "tags" embebed c# code in asp.net web pages <% code %>. if need print values use <%= code returning value %>

here literal transcripted fo write in php:

    <% if(1==1){ %>       <h1>hellow world!</h1>     <% }else{ %>       <h1>bye world!</h1>     <% } %> 

but can same output this:

<%= 1 == 1 ? "<h1>hellow world!</h1>" : "<h1>bye world!</h1>" %> 

or

<h1><%= 1 == 1 ? "hellow" : "bye" %> world!</h1> 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -