Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to echo something in C# in an .aspx file

Tags:

c#

asp.net

I know you can do this

<%= Request.Form[0] %>

But how do you do something like this?

<% if(Request.Form[0]!=null)
     echo "abc";
%>
like image 699
Aximili Avatar asked Mar 17 '10 04:03

Aximili


People also ask

Can you use echo in C?

The echo command is one of the most commonly and widely used built-in commands for Linux bash and C shells, that typically used in a scripting language and batch files to display a line of text/string on standard output or a file. 2.

What does echoing mean in C?

In computing, echo is a command that outputs the strings that are passed to it as arguments. It is a command available in various operating system shells and typically used in shell scripts and batch files to output status text to the screen or a computer file, or as a source part of a pipeline. echo.

What is output Statement C?

Output : In any programming language output means to display some data on screen, printer or in any file. C programming language provides a set of built-in functions to output required data.

What type does echo return?

Unlike some other language constructs, echo does not have any return value, so it cannot be used in the context of an expression. echo also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign.


2 Answers

<% if(Request.Form[0]!=null)
    Response.Write("abc");
%>
like image 163
Dean Harding Avatar answered Oct 01 '22 18:10

Dean Harding


Maybe you want to show the form value unless it doesn't exist then show "abc"?

<%= Request.Form[0] ?? "abc" %>

Or you could can use if blocks and normal markup inside.

<% if(Request.Form[0]!=null) { %>

   <div class="echo">abc</div>

<% } %>
like image 40
tarn Avatar answered Oct 01 '22 19:10

tarn