Exemplo n.º 1
0
        /// <include file='doc\WmlFormAdapter.uex' path='docs/doc[@for="WmlFormAdapter.Render"]/*' />
        public override void Render(WmlMobileTextWriter writer)
        {
            String formsAuthCookieName = FormsAuthentication.FormsCookieName;
            if(!Device.SupportsRedirectWithCookie)
            {
                if(!String.IsNullOrEmpty(formsAuthCookieName))
                {
                    HttpContext.Current.Response.Cookies.Remove(formsAuthCookieName);
                }
            }

            writer.BeginForm(Control);
            if (Page.Adapter.PersistCookielessData &&
                Device.CanRenderOneventAndPrevElementsTogether &&
                !String.IsNullOrEmpty(formsAuthCookieName) &&
                Control == Page.ActiveForm )
            {
                IDictionary dictionary = PageAdapter.CookielessDataDictionary;
                if(dictionary != null)
                {
                    String value = (String)dictionary[formsAuthCookieName];
                    if(!String.IsNullOrEmpty(value))
                    {
                        writer.AddFormVariable("__facn", value, false);
                    }
                }
            }
            MobileControl secondaryUIControl = SecondaryUIControl as MobileControl;
            writer.EnterLayout(Style);
            if (secondaryUIControl != null && secondaryUIControl.Form == Control)
            {
                SetControlPageRecursive(secondaryUIControl, -1);
                secondaryUIControl.RenderControl(writer);
            }
            else
            {
                if (Control.HasControls())
                {
                    Panel header = Control.Header;
                    Panel footer = Control.Footer;

                    if (header != null)
                    {
                        writer.BeginCustomMarkup();
                        header.RenderControl(writer);
                        writer.EndCustomMarkup();
                    }

                    foreach(Control control in Control.Controls)
                    {
                        if (control != header && control != footer)
                        {
                            control.RenderControl(writer);
                        }
                    }

                    RenderPager(writer);

                    if (footer != null)
                    {
                        writer.BeginCustomMarkup();
                        footer.RenderControl(writer);
                        writer.EndCustomMarkup();
                    }
                }
                else
                {
                    RenderPager(writer);
                }
            }
            writer.ExitLayout(Style);
            writer.EndForm();
        }