ASP.Net/Response/Write

Материал из .Net Framework эксперт
Версия от 11:54, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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>