public override void Render(WmlMobileTextWriter writer)
        {
            String value            = Control.Text;
            bool   requiresRandomID = RequiresRandomID();

            writer.EnterLayout(Style);
            if (Control.Password)
            {
                value = String.Empty;
            }

            if (!PageAdapter.RequiresValueAttributeInInputTag())
            {
                writer.AddFormVariable(Control.ClientID, value, requiresRandomID);
            }
            else
            {
                // This is to make sure an id is determined in the first
                // pass, and this is done in AddFormVariable as well.
                writer.MapClientIDToShortName(Control.ClientID, requiresRandomID);
            }

            String format = ((IAttributeAccessor)Control).GetAttribute("wmlFormat");

            if (format == null || format == String.Empty)
            {
                if (Control.Numeric)
                {
                    format = "*N";
                }
                else
                {
                    format = null;
                }
            }

            writer.RenderTextBox(Control.ClientID,
                                 value,
                                 format,
                                 Control.Title,
                                 Control.Password,
                                 Control.Size,
                                 Control.MaxLength,
                                 requiresRandomID,
                                 Control.BreakAfter);
            writer.ExitLayout(Style);
        }
        /// <include file='doc\WmlTextBoxAdapter.uex' path='docs/doc[@for="WmlTextBoxAdapter.Render"]/*' />
        public override void Render(WmlMobileTextWriter writer)
        {
            String value = Control.Text;
            bool requiresRandomID = RequiresRandomID();

            writer.EnterLayout(Style);
            if (Control.Password)
            {
                value = String.Empty;
            }

            if (!PageAdapter.RequiresValueAttributeInInputTag())
            {
                writer.AddFormVariable(Control.ClientID, value, requiresRandomID);
            }
            else
            {
                // This is to make sure an id is determined in the first
                // pass, and this is done in AddFormVariable as well.
                writer.MapClientIDToShortName(Control.ClientID, requiresRandomID);
            }

            String format = ((IAttributeAccessor)Control).GetAttribute("wmlFormat");
            if (String.IsNullOrEmpty(format))
            {
                if (Control.Numeric)
                {
                    format = "*N";
                }
                else
                {
                    format = null;
                }
            }
            
            writer.RenderTextBox(Control.ClientID, 
                                 value,
                                 format, 
                                 Control.Title,
                                 Control.Password, 
                                 Control.Size, 
                                 Control.MaxLength, 
                                 requiresRandomID,
                                 Control.BreakAfter);
            writer.ExitLayout(Style);
        }
Example #3
0
        /// <include file='doc\WmlControlAdapter.uex' path='docs/doc[@for="WmlControlAdapter.RenderBeginLink"]/*' />
        protected void RenderBeginLink(WmlMobileTextWriter writer,
                                       String targetUrl,
                                       String softkeyLabel,
                                       bool implicitSoftkeyLabel,
                                       bool mapToSoftkey)
        {
            if (mapToSoftkey && !writer.IsValidSoftkeyLabel(softkeyLabel))
            {
                // If softkey label was specified explicitly, then truncate.
                if (!implicitSoftkeyLabel && softkeyLabel.Length > 0)
                {
                    softkeyLabel = softkeyLabel.Substring(0, Device.MaximumSoftkeyLabelLength);
                }
                else
                {
                    softkeyLabel         = GetDefaultLabel(LinkLabel);
                    implicitSoftkeyLabel = true;
                }
            }

            String postback = DeterminePostBack(targetUrl);

            if (postback != null)
            {
                writer.RenderBeginPostBack(softkeyLabel, implicitSoftkeyLabel, mapToSoftkey);
            }
            else
            {
                String prefix = Constants.FormIDPrefix;
                if (targetUrl.StartsWith(prefix, StringComparison.Ordinal))
                {
                    String formID = targetUrl.Substring(prefix.Length);
                    Form   form   = Control.ResolveFormReference(formID);
                    targetUrl = prefix + form.ClientID;
                }
                else
                {
                    bool absoluteUrl = ((targetUrl.StartsWith("http:", StringComparison.Ordinal)) || (targetUrl.StartsWith("https:", StringComparison.Ordinal)));
                    // AUI 3652
                    targetUrl = Control.ResolveUrl(targetUrl);
                    bool        queryStringWritten  = targetUrl.IndexOf('?') != -1;
                    IDictionary dictionary          = PageAdapter.CookielessDataDictionary;
                    String      formsAuthCookieName = FormsAuthentication.FormsCookieName;
                    if ((dictionary != null) && (!absoluteUrl) && (Control.MobilePage.Adapter.PersistCookielessData))
                    {
                        StringBuilder sb = new StringBuilder(targetUrl);

                        foreach (String name in dictionary.Keys)
                        {
                            if (queryStringWritten)
                            {
                                sb.Append("&amp;");
                            }
                            else
                            {
                                sb.Append("?");
                                queryStringWritten = true;
                            }

                            if (name.Equals(formsAuthCookieName) && Device.CanRenderOneventAndPrevElementsTogether)
                            {
                                sb.Append(name);
                                sb.Append("=$(");
                                sb.Append(writer.MapClientIDToShortName("__facn", false));
                                sb.Append(")");
                            }
                            else
                            {
                                sb.Append(name);
                                sb.Append("=");
                                sb.Append(dictionary[name]);
                            }
                        }
                        targetUrl = sb.ToString();
                    }
                }

                writer.RenderBeginHyperlink(targetUrl,
                                            false,
                                            softkeyLabel,
                                            implicitSoftkeyLabel,
                                            mapToSoftkey);
            }
        }