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 id="items" class="System.Collections.ArrayList" runat="server"/>
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 id="ArrayItems" class="System.Collections.ArrayList" runat=server/> <asp:datalist id="MyList" runat=server> <ItemTemplate> Here is a value: <%# Container.DataItem %> </ItemTemplate> </asp:datalist> </body> </html>