예제 #1
0
            public DocumentZone(HtmlHelper html, string targetZone, ZoneInjectMode injectMode, string key)
            {
                Guard.NotEmpty(targetZone, nameof(targetZone));

                _viewContext = html.ViewContext;
                _originalViewContextWriter = _viewContext.Writer;
                _page = (WebViewPage)html.ViewDataContainer;

                var writer = new StringWriter();

                _page.OutputStack.Push(writer);
                _viewContext.Writer = writer;

                _targetZone = targetZone;
                _injectMode = injectMode;

                if (key.HasValue())
                {
                    if (HasUniqueKey(key))
                    {
                        _isVoid = true;
                    }
                    else
                    {
                        UniqueKeys.Add(key);
                    }
                }

                if (_page.Request.IsAjaxRequest())
                {
                    _isVoid = true;
                }
            }
예제 #2
0
 public static IDisposable BeginZoneContent(this HtmlHelper helper,
                                            string targetZone,
                                            ZoneInjectMode injectMode = ZoneInjectMode.Append,
                                            string key = null)
 {
     return(new DocumentZone(helper, targetZone, injectMode, key));
 }
예제 #3
0
        public static IDisposable BeginZoneContent(this HtmlHelper helper,
                                                   string targetZone,
                                                   ZoneInjectMode injectMode = ZoneInjectMode.Append,
                                                   string key = null)
        {
            if (key.HasValue() && DocumentZone.HasUniqueKey(key))
            {
                return(ActionDisposable.Empty);
            }

            return(new DocumentZone((WebViewPage)helper.ViewDataContainer, targetZone, injectMode, key));
        }
예제 #4
0
            public DocumentZone(WebViewPage page, string targetZone, ZoneInjectMode injectMode, string key)
            {
                Guard.NotEmpty(targetZone, nameof(targetZone));

                _page = page;
                _page.OutputStack.Push(new StringWriter());

                _targetZone = targetZone;
                _injectMode = injectMode;

                if (key.HasValue())
                {
                    UniqueKeys.Add(key);
                }
            }