ASP.NET Tutorial/Mobile/Header

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Displaying header

<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" %>
<script runat="server" language="c#">
protected void Page_Load(Object sender, EventArgs e) {
    NameValueCollection nvc = Request.Headers;
    string[] keys = nvc.AllKeys;
    for(int i = 0; i < keys.Length; i++) {
        string[] values = nvc.GetValues(keys[i]);
        System.Web.UI.MobileControls.Label lbl = new System.Web.UI.MobileControls.Label();
        lbl.Text = keys[i] + ":" ;
        for(int j = 0; j < values.Length; j++) {
            lbl.Text += " " + values[j]; 
        }
        form1.Controls.Add(lbl);
    }
}
</script>
<mobile:Form id="form1" runat="server" Paginate="true" >
</mobile:Form>