Beispiel #1
0
        protected internal override void Render(HtmlTextWriter markupWriter)
        {
            WmlTextWriter writer = (WmlTextWriter)markupWriter;
            String        source = Control.ImageUrl;
            String        text   = Control.AlternateText;

            writer.EnterStyle(Control.ControlStyle);

            // writer.EnterLayout(Style);

            if (source != null && source.Length == 0)
            {
                // Just write the alternate as text
                writer.WriteEncodedText(text);
            }
            else
            {
                String localSource;

                string symbolProtocol = "symbol:";
                if (StringUtil.StringStartsWith(source, symbolProtocol))
                {
                    localSource = source.Substring(symbolProtocol.Length);
                    source      = String.Empty;
                }
                else
                {
                    localSource = null;
                    // AUI 3652
                    source = Control.ResolveClientUrl(source);
                }
                writer.RenderImage(source, localSource, text);
            }
            writer.ExitStyle(Control.ControlStyle);
        }
Beispiel #2
0
        protected internal override void Render(HtmlTextWriter markupWriter)
        {
            WmlTextWriter writer    = (WmlTextWriter)markupWriter;
            String        targetUrl = Control.NavigateUrl;

            String text = Control.Text;

            if (text.Length == 0)
            {
                // Whidbey 18195

                foreach (Control child in Control.Controls)
                {
                    if (child is IStaticTextControl)
                    {
                        text = ((IStaticTextControl)child).Text;
                        break;
                    }
                    else if (child is DataBoundLiteralControl)
                    {
                        text = ((DataBoundLiteralControl)child).Text;
                        break;
                    }
                }
            }

            String softkeyLabel = Control.SoftkeyLabel;

            if (softkeyLabel.Length == 0)
            {
                softkeyLabel = Control.Text;
            }
            writer.EnterStyle(Control.ControlStyle);
            // AUI 3652
            targetUrl = Control.ResolveClientUrl(targetUrl);

            targetUrl = Control.GetCountClickUrl(targetUrl);

            // If cookieless mode is on, we need to apply the app path modifier for if the request is authenticated
            HttpContext context = HttpContext.Current;

            Debug.Assert(context != null);
            bool cookieless = CookielessHelperClass.UseCookieless(context, false, FormsAuthentication.CookieMode);

            if (cookieless && context.Request != null && context.Request.IsAuthenticated && context.Response != null)
            {
                targetUrl = context.Response.ApplyAppPathModifier(targetUrl);
            }

            PageAdapter.RenderBeginHyperlink(writer, targetUrl, false /* encode, Whidbey 111129 */, softkeyLabel, Control.AccessKey);
            String source = Control.ImageUrl;

            if (Control.ImageUrl != null && Control.ImageUrl.Length > 0)
            {
                writer.RenderImage(source, null /* localsource */, text /* alternateText */);
            }
            else
            {
                writer.Write(text);
            }
            PageAdapter.RenderEndHyperlink(writer);
            writer.ExitStyle(Control.ControlStyle);
        }