Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scripting equivalent of Document.Write()

Tags:

c#

asp.net

I want to use the C# Scripting language on ASP.net. And I also want to manipulate my html page by using document.write, and I can't find the option in C#. I also edit my code straight to the html code and not on the .aspx.cs file. So is there any same function of document.write to the c#?

like image 332
Mark Cortejo Avatar asked Jul 10 '26 01:07

Mark Cortejo


2 Answers

Take a look at this: http://msdn.microsoft.com/en-in/library/ms178135(v=vs.100).aspx

It talks about embedded code blocks which can execute during the render phase of the page.

From the above url:

<%@ Page Language="C#" %>
<html>
<body>
    <form id="form1" runat="server">
    <% for(int i = 0; i < 6; i++) %>
       <% { Response.Write("<br>" + i.ToString()); }%>
    </form>
</body>
</html>
like image 118
NoviceProgrammer Avatar answered Jul 15 '26 23:07

NoviceProgrammer


try this

<%@ Page Title="Sample" Language="C#"  %>
<%
    var str = "hi!";
    Response.Write(str);

    Response.Write("hi");
%>
like image 22
Sunny Avatar answered Jul 15 '26 23:07

Sunny