关闭

Windows Mobile asp.net第一個程序

883人阅读 评论(0) 收藏 举报
<%@ 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

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:223542次
    • 积分:3683
    • 等级:
    • 排名:第9109名
    • 原创:131篇
    • 转载:33篇
    • 译文:0篇
    • 评论:43条
    最新评论