快意人生

 1

MobileCapabilities currentCapabilities = 
                (MobileCapabilities)Request.Browser;

            
// Programatically find the mobile capabilities without using 
            
// DeviceSpecific Filters.
            if(currentCapabilities.PreferredRenderingMIME=="text/html")
            
{
                Label1.Text 
= "You are using an html supported device.";
            }

            
else if(currentCapabilities.PreferredRenderingMIME=="text/vnd.wap.wml")
            
{
                Label1.Text 
= "You are using a wml supported device.";
            }

            Label1.Text 
= "Screen Width (chars): " + 
                currentCapabilities.ScreenCharactersWidth;

2
public class MobileWebForm1 : System.Web.UI.MobileControls.MobilePage
    
{
        
protected System.Web.UI.MobileControls.SelectionList SelectionList1;
        
protected System.Web.UI.MobileControls.Label Label1;
        
protected System.Web.UI.MobileControls.TextView TextView1;
        
protected System.Web.UI.MobileControls.Command Command1;
        
protected System.Web.UI.MobileControls.Form Form1;

        
private void Page_Load(object sender, System.EventArgs e)
        
{
            
// 在此处放置用户代码以初始化页面
            
                }


        
Web 窗体设计器生成的代码


        
protected void HandleMultiTeamSelection(object source,EventArgs args)
        
{
            MobileListItemCollection colItems 
= SelectionList1.Items;
            String strDisplaytext
="";
            
foreach (MobileListItem item in colItems)
            
{
                
if(item.Selected)
                
{
                    strDisplaytext
+=(item.Text + ":" + item.Value + "</BR>");
                    
                }

            }

            Label1.Text
=strDisplaytext;
        
//TextView1.Text=strDisplaytext;
        }
posted on 2006-05-17 11:47  快意人生  阅读(1091)  评论(0)    收藏  举报