ASP.Net/Response/Write — различия между версиями

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

Текущая версия на 11:54, 26 мая 2010

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

<script language="VB" runat="server">
Sub Page_Load()
 Response.Write ("First ASP.NET Line<br />")
 Response.Write ("Second ASP.NET Line<br />")
 Response.Write ("Third ASP.NET Line<br />")
End Sub
</script>
<html>
  <head>
    <title>Inserting ASP.NET code Example</title>
  </head>
  <body>
    Line1: First HTML Line<br />
    Line2: Second HTML Line<br />
    Line3: Third HTML Line<br />
  </body>
</html>



Use Response Write to output HTML (C#)

<%@ Page Language="C#" %>
<html>
<head>
</head>
<body>
    <% Response.Write("Hello!<br/>");%>
    Line1: First HTML Line<br/>
    <% Response.Write("First ASP.NET Line<br />"); %>
    Line2: Second HTML Line<br/>
    <% Response.Write("Second ASP.NET Line<br />"); %>
    Line3: Third HTML Line<br/>
    <% Response.Write("Third ASP.NET Line<br />"); %>
    <% Response.Write("Goodbye!"); %>
</body>
</html>



Writing character output (VB.net)

<%@ 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>



Writing Output (VB.net)

<%@ 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>