Mobile Capabilities : Mobile Capabilities « Mobile Control « ASP.Net






Mobile Capabilities

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:Form ID="Form1" runat="server">
        Language is
        <mobile:Label runat="server" font-bold="true" id="theBrowser" />
    </mobile:Form>
</body>
</html>

File: Default.aspx.cs

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 Hello : System.Web.UI.MobileControls.MobilePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MobileCapabilities mobCaps = (MobileCapabilities)Request.Browser;
        theBrowser.Text = mobCaps.PreferredRenderingType;
    }
}

 








Related examples in the same category

1.Get mobile device information (VB.net)
2.Get mobile device code Capabilities (VB.net)
3.Get mobile device screen width and height (VB.net)
4.Mobile Capabilities: support color? (VB.net)
5.Preferred RenderingType