ASP.Net/Response/Write

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Use Response.Write to add HTML (VB.net)

   <source lang="csharp">

<script language="VB" runat="server"> Sub Page_Load()

Response.Write ("First ASP.NET Line
") Response.Write ("Second ASP.NET Line
") Response.Write ("Third ASP.NET Line
")

End Sub </script> <html>

 <head>
   <title>Inserting ASP.NET code Example</title>
 </head>
 <body>
   Line1: First HTML Line
Line2: Second HTML Line
Line3: Third HTML Line
</body>

</html>

      </source>
   
  


Use Response Write to output HTML (C#)

   <source lang="csharp">

<%@ Page Language="C#" %> <html> <head> </head> <body>

   <% Response.Write("Hello!
");%> Line1: First HTML Line
<% Response.Write("First ASP.NET Line
"); %> Line2: Second HTML Line
<% Response.Write("Second ASP.NET Line
"); %> Line3: Third HTML Line
<% Response.Write("Third ASP.NET Line
"); %> <% Response.Write("Goodbye!"); %>

</body> </html>

      </source>
   
  


Writing character output (VB.net)

   <source lang="csharp">

<%@ Page Language="vb" %> <html>

  <head>
     <title>Writing character output in ASP.NET</title>
     <script runat="server">
        Sub Page_Load()
           Dim MyChars(2) As Char
           Dim MyChar As Char
           MyChars(0) = "A"
           MyChars(1) = "B"
           MyChars(2) = "C"
           For Each MyChar in MyChars
              Response.Write(MyChar)
           Next
        End Sub
     </script>
  </head>

<body>

  <asp:label id="Message" runat="server"/>

</body> </html>

      </source>
   
  


Writing Output (VB.net)

   <source lang="csharp">

<%@ Page Language="vb" %> <html>

  <head>
     <title>Writing Output in ASP.NET</title>
     <script runat="server">
        Sub Page_Load()
           Dim myWriter As System.IO.TextWriter
           myWriter = Response.Output
           myWriter.WriteLine("www.nfex.ru!")
        End Sub
     </script>
  </head>

<body>

  <asp:label id="Message" runat="server"/>

</body> </html>

      </source>