GOCHESTER.COM
Search:
 
 
Membership
 
  Member Login
Become a Member
Reset Password
 
     

 
Site Links
 
  Index
News Articles
View Articles By Category
 
     

 
ASP.NET Mobile Control: ObjectList Control
Category: ASP.NET
By: - June 12th, 2009
This article has been read: 122 times.

The details you can find in the MSDN document:
MSDN: Object Control


You can also download the Microsoft Mobile Explorer Emulator. here
( Microsfot Mobile Explorer 3.0 Emulator - Preview content for MME multi-statndard mobile phone browser.)


The code example for ASP.NET Mobile control: "ObjectList"


<br /> <%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"<br /> Language="VB" %><br /> <%@ Register TagPrefix="mobile"<br /> Namespace="System.Web.UI.MobileControls"<br /> Assembly="System.Web.Mobile" %><br /> <br /> <script language="vb" runat="server"><br /> <br /> Public Class GroceryItem<br /> private _department, _item, _status As String<br /> <br /> Public Sub New( department As String, item As String, status As String)<br /> _department = department<br /> _item = item<br /> _status = status<br /> End Sub<br /> <br /> Public ReadOnly Property Department as String<br /> Get<br /> Return _department<br /> End Get<br /> End Property<br /> Public ReadOnly Property Item as String<br /> Get<br /> Return _item<br /> End Get<br /> End Property<br /> Public ReadOnly Property Status as String<br /> Get<br /> Return _status<br /> End Get<br /> End Property<br /> End Class<br /> <br /> Public Sub Page_Load(o As Object, e As EventArgs)<br /> If Not IsPostBack Then<br /> Dim arr As New ArrayList()<br /> arr.Add (New GroceryItem ("Bakery", "French Rolls", "On Sale"))<br /> arr.Add (New GroceryItem ("Dairy", "Eggnog", "Half price"))<br /> arr.Add (New GroceryItem ("Produce", "Apples", "A dollar a bushel"))<br /> <br /> List1.DefaultCommand = "Default"<br /> List1.MoreText = "Click for Details"<br /> List1.DataSource = arr<br /> List1.DataBind<br /> End If<br /> End Sub<br /> <br /> Public Sub List1_Click(sender As Object, e As ObjectListCommandEventArgs)<br /> If e.CommandName = "Reserve" Then<br /> ActiveForm = Form2<br /> ElseIf e.CommandName = "Buy"<br /> ActiveForm = Form3<br /> Else<br /> ActiveForm = Form4<br /> End If<br /> End Sub<br /> <br /> </script><br /> <br /> <mobile:Form id="Form1" runat="server" BackColor="LightBlue"><br /> <mobile:ObjectList id="List1" runat="server"<br /> LabelField="item"<br /> OnItemCommand="List1_Click"><br /> <Command Name="Reserve" Text="Reserve"/><br /> <Command Name="Buy" Text="Buy"/><br /> </mobile:ObjectList><br /> </mobile:Form><br /> <br /> <mobile:Form id="Form2" runat="server" BackColor="LightBlue"><br /> <mobile:Label id="ResLabel" runat="server"<br /> text="Sale item reservation system coming soon!" /><br /> <mobile:Link id="ResLink" NavigateURL="#Form1" runat="server" text="Return" /><br /> </mobile:Form><br /> <br /> <mobile:Form id="Form3" runat="server" BackColor="LightBlue"><br /> <mobile:Label id="BuyLabel" runat="server"<br /> text="Online purchasing system coming soon!" /><br /> <mobile:Link id="BuyLink" NavigateURL="#Form1" runat="server" text="Return" /><br /> </mobile:Form><br /> <br /> <mobile:Form id="Form4" runat="server" BackColor="LightBlue"><br /> <mobile:Label id="DefLabel" runat="server"<br /> text="Detailed descriptions of the items will be here soon!" /><br /> <mobile:Link id="DefLink" NavigateURL="#Form1" runat="server" text="Return" /><br /> </mobile:Form><br /> [C#]<br /> <%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"<br /> Language="C#" %><br /> <%@ Register TagPrefix="mobile"<br /> Namespace="System.Web.UI.MobileControls"<br /> Assembly="System.Web.Mobile" %><br /> <br /> <script language="c#" runat="server"><br /> <br /> class GroceryItem<br /> {<br /> private String _department, _item, _status;<br /> <br /> public GroceryItem(string department, string item, string status)<br /> { <br /> _department = department;<br /> _item = item;<br /> _status = status;<br /> }<br /> <br /> public String Department { get { return _department; } }<br /> public String Item { get { return _item; } }<br /> public String Status { get { return _status; } }<br /> }<br /> <br /> public void Page_Load(Object o, EventArgs e)<br /> {<br /> if (!IsPostBack)<br /> {<br /> ArrayList arr = new ArrayList();<br /> arr.Add (new GroceryItem ("Bakery", "French Rolls", "On Sale"));<br /> arr.Add (new GroceryItem ("Dairy", "Eggnog", "Half price"));<br /> arr.Add (new GroceryItem ("Produce", "Apples", "A dollar a bushel"));<br /> <br /> List1.DefaultCommand = "Default";<br /> List1.MoreText = "Click for Details";<br /> List1.DataSource = arr;<br /> List1.DataBind ();<br /> }<br /> }<br /> <br /> public void List1_Click(Object sender, ObjectListCommandEventArgs e)<br /> {<br /> if (e.CommandName == "Reserve")<br /> {<br /> ActiveForm = Form2;<br /> }<br /> else if (e.CommandName == "Buy")<br /> {<br /> ActiveForm = Form3;<br /> }<br /> else<br /> {<br /> ActiveForm = Form4;<br /> }<br /> }<br /> <br /> </script><br /> <br /> <mobile:Form id="Form1" runat="server" BackColor="LightBlue"><br /> <mobile:ObjectList id="List1" runat="server"<br /> LabelField="item"<br /> OnItemCommand="List1_Click"><br /> <Command Name="Reserve" Text="Reserve"/><br /> <Command Name="Buy" Text="Buy"/><br /> </mobile:ObjectList><br /> </mobile:Form><br /> <br /> <mobile:Form id="Form2" runat="server" BackColor="LightBlue"><br /> <mobile:Label id="ResLabel" runat="server"<br /> text="Sale item reservation system coming soon!" /><br /> <mobile:Link id="ResLink" NavigateURL="#Form1" runat="server" text="Return" /><br /> </mobile:Form><br /> <br /> <mobile:Form id="Form3" runat="server" BackColor="LightBlue"><br /> <mobile:Label id="BuyLabel" runat="server"<br /> text="Online purchasing system coming soon!" /><br /> <mobile:Link id="BuyLink" NavigateURL="#Form1" runat="server" text="Return" /><br /> </mobile:Form><br /> <br /> <mobile:Form id="Form4" runat="server" BackColor="LightBlue"><br /> <mobile:Label id="DefLabel" runat="server"<br /> text="Detailed descriptions of the items will be here soon!" /><br /> <mobile:Link id="DefLink" NavigateURL="#Form1" runat="server" text="Return" /><br /> </mobile:Form><br />




Notes: (other resource for ASP.NET Mobile Web application

  • How to make ASP.NET Applications that support mobile devices.  
    [Details]


  • .NET Mobile Tutorial
    [Details]


  • Getting Started with Windows Mobile Application Development   [Details]


  • Tip/Trick: ASP.NET Mobile Development with Visual Studio 2008  [Details]












Back to News Articles
View Articles From ASP.NET Category