<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    
<mobile:Form id="ListStuff" runat="server" BackColor="White" ForeColor="#bb7023">
        
<mobile:Label ID="Label1" Runat="server">Pick a Language!</mobile:Label>
        
<mobile:List ID="ListMe" Runat="server" OnItemCommand="ListMe_ItemCommand">
            
<Item Text="English" Value="English" />
            
<Item Text="Chinese" Value="Chinese" />
            
<Item Text="French" Value="French" />
            
<Item Text="German" Value="German" />
            
<Item Text="Italian" Value="Italian" />
            
<Item Text="Norwegian" Value="Norwegian" />
            
<Item Text="Protuguese" Value="Protuguese" />
        
</mobile:List>

    
</mobile:Form>
    
<mobile:Form ID="SecondForm" Runat="server" BackColor="White" ForeColor="Green">
        
<mobile:Label ID="Label2" Runat="server">Your &quot;Hello World&quot; Translation</mobile:Label>
        
<mobile:Label ID="Selection" Runat="server">
        
</mobile:Label>
        
<mobile:Link ID="GoBack" Runat="server" NavigateUrl="#ListStuff">back</mobile:Link>
    
</mobile:Form>
</body>
</html>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Mobile;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.MobileControls;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class Default2 : System.Web.UI.MobileControls.MobilePage
{
    
protected void Page_Load(object sender, EventArgs e)
    
{

    }

    
protected void ListMe_ItemCommand(object sender, ListCommandEventArgs e)
    
{
        Selection.Text 
= "Your selected " + e.ListItem.Text;
        ActiveForm 
= SecondForm;
        
switch (e.ListItem.Text)
        
{
            
case "Chinese":
                Selection.Text 
= "世界你好";
                
break;
            
case "French":
                Selection.Text 
= "Bonjour le monde";
                
break;
            
case "German":
                Selection.Text 
= "Hallo Welt";
                
break;
            
case "Italian":
                Selection.Text 
= "Ciao il mondo";
                
break;
            
case "Norwegian":
                Selection.Text 
= "Hei verden";
                
break;
            
case "Portuguese":
                Selection.Text 
= "Oi mundo";
                
break;
            
default:
                Selection.Text 
= "Hello World";
                
break;
        }

    }

}

 001002

posted on 2007-09-14 09:53  wkjs  阅读(194)  评论(0编辑  收藏  举报