Mega Code Archive

 
Categories / ASP.Net Tutorial / Mobile
 

Show Capabilities

<%@ Page  Inherits="System.Web.UI.MobileControls.MobilePage" Language="cs" %> <%@ Import Namespace="System.Reflection" %> <%@ Import Namespace="System.Web.Mobile" %> <script runat="server" language="c#"> protected void Page_Load(Object sender, EventArgs e) {     MobileCapabilities capabilities = (MobileCapabilities)Request.Browser;     Type t = typeof(MobileCapabilities);     PropertyInfo[] propertyInfos = t.GetProperties();     foreach(PropertyInfo pi in propertyInfos) {         System.Web.UI.MobileControls.Label lbl = new System.Web.UI.MobileControls.Label();         lbl.Text = pi.Name + " = " + capabilities[pi.Name];         form1.Controls.Add(lbl);     } } </script> <mobile:Form id="form1" runat="server" Paginate="true" > </mobile:Form>