Object Tag Syntax: <object runat="server" />

Object tags enable page developers to declare and create instances of variables using a declarative, tag-based syntax. The following example demonstrates how the object tag can be used to create an instance of an ArrayList class.

<object />

The object will be created automatically at run time and can then be accessed through the ID "items".

<html>

   <script language="C#" runat=server>

      void Page_Load(Object sender, EventArgs e) {

         ArrayItems.Add("One");
         ArrayItems.Add("Two");
         ArrayItems.Add("Three");

         MyList.DataSource = ArrayItems;
         MyList.DataBind();
      }

   </script>

   <body>
   
   <object >/>

      <asp:datalist >>

         <ItemTemplate>

            Here is a value: <%# Container.DataItem %>

         </ItemTemplate>

      </asp:datalist>

   </body>

</html>
ASP.NET 2.0学习笔记之Object Tag Syntax

相关文章:

  • 2021-07-09
  • 2021-06-20
  • 2021-11-02
  • 2021-05-19
  • 2022-12-23
  • 2021-09-06
  • 2021-10-22
  • 2022-02-28
猜你喜欢
  • 2021-11-18
  • 2022-03-03
  • 2022-01-11
  • 2021-10-24
  • 2021-10-27
相关资源
相似解决方案