temp.aspx

来自「asp入门到精通的源代码」· ASPX 代码 · 共 48 行

ASPX
48
字号
<%@ Page Inherits="System.Mobile.UI.MobilePage" Language="C#" %>
<%@ Register TagPrefix="Mobile" Namespace="System.Mobile.UI" %>
<%@ Import Namespace="System.ComponentModel" %>
<%@ Import Namespace="System.Mobile" %>

<script runat="server" language="c#">

protected void Page_Load(Object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        // Add all property names found in the device capabilities class.

        MobileCapabilities properties = (MobileCapabilities)Request.Browser;

        //PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (Request.Browser);
        if (properties != null)
        {
            // Bind directly to list, which can extract Name property from
            // each property.
            CapabilityList.DataSource = properties;
            CapabilityList.DataBind ();
        }
    }
}

protected void CapabilityList_OnClick(Object sender, ListCommandEventArgs e)
{
    String propertyName = e.ListItem.Text;
    CapabilityName.Text = propertyName;
    CapabilityValue.Text = DataBinder.Eval (Request.Browser, propertyName, "{0}");

    ActiveForm = SecondForm;
}

</script>

<Mobile:Form runat="server" Wrapping="NoWrap">
    <Mobile:Label runat="server" StyleReference="title" Text="Mobile Capabilities" />
    <Mobile:List runat="server" id="CapabilityList" DataTextField="Name" 
        OnItemCommand="CapabilityList_OnClick" AllowPaging="true" />
</Mobile:Form>

<Mobile:Form runat="server" id="SecondForm">
    <Mobile:Label runat="server" id="CapabilityName" StyleReference="title" />
    <Mobile:Label runat="server" id="CapabilityValue" />
</Mobile:Form>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?