Exemple #1
0
        protected override void RenderEndTag(HtmlTextWriter writer)
        {
            if (_footerTemplate != null)
            {
                using (var literal = new Literal())
                {
                    _footerTemplate.InstantiateIn(literal);
                    literal.RenderControl(writer);
                }
            }

            if (this.RenderMode != ListRenderMode.None)
            {
                writer.RenderEndTag();
            }
        }
Exemple #2
0
        protected override void RenderBeginTag(HtmlTextWriter writer)
        {
            var tagName = string.Empty;

            switch (this.RenderMode)
            {
            case ListRenderMode.List:
                tagName = "dl";
                break;

            case ListRenderMode.BulletList:
                tagName = "ul";
                break;

            case ListRenderMode.OrderedList:
                tagName = "ol";
                break;
            }

            if (!string.IsNullOrWhiteSpace(tagName))
            {
                if (!string.IsNullOrWhiteSpace(this.ID))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID);
                }

                if (!string.IsNullOrWhiteSpace(this.CssClass))
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
                }

                writer.RenderBeginTag(tagName);
            }

            if (_headerTemplate != null)
            {
                using (var literal = new Literal())
                {
                    _headerTemplate.InstantiateIn(literal);
                    literal.RenderControl(writer);
                }
            }
        }
Exemple #3
0
        protected override void RenderContent(HtmlTextWriter writer)
        {
            if (Utility.IsEmptyCollection(this.DataSource))
            {
                if (_emptyTemplate != null)
                {
                    using (var literal = new Literal())
                    {
                        _emptyTemplate.InstantiateIn(literal);
                        literal.RenderControl(writer);
                    }
                }

                return;
            }

            IEnumerable dataItems = this.DataSource as IEnumerable;

            if (dataItems == null || dataItems.GetType() == typeof(string))
            {
                var item = new DataItemContainer <ListView>(this, this.DataSource, 0);
                this.RenderItem(writer, item);
            }
            else
            {
                int index = 0;

                foreach (var dataItem in dataItems)
                {
                    FormExtension.PushDataItem(this.Page, dataItem, index);

                    var item = new DataItemContainer <ListView>(this, dataItem, index++);
                    this.RenderItem(writer, item);

                    FormExtension.PopDataItem(this.Page);
                }
            }
        }
Exemple #4
0
		protected override void RenderContent(HtmlTextWriter writer)
		{
			if(Utility.IsEmptyCollection(this.DataSource))
			{
				if(_emptyTemplate != null)
				{
					using(var literal = new Literal())
					{
						_emptyTemplate.InstantiateIn(literal);
						literal.RenderControl(writer);
					}
				}

				return;
			}

			IEnumerable dataItems = this.DataSource as IEnumerable;

			if(dataItems == null || dataItems.GetType() == typeof(string))
			{
				var item = new DataItemContainer<ListView>(this, this.DataSource, 0);
				this.RenderItem(writer, item);
			}
			else
			{
				int index = 0;

				foreach(var dataItem in dataItems)
				{
					FormExtension.PushDataItem(this.Page, dataItem, index);

					var item = new DataItemContainer<ListView>(this, dataItem, index++);
					this.RenderItem(writer, item);

					FormExtension.PopDataItem(this.Page);
				}
			}
		}
Exemple #5
0
		protected override void RenderEndTag(HtmlTextWriter writer)
		{
			if(_footerTemplate != null)
			{
				using(var literal = new Literal())
				{
					_footerTemplate.InstantiateIn(literal);
					literal.RenderControl(writer);
				}
			}

			if(this.RenderMode != ListRenderMode.None)
				writer.RenderEndTag();
		}
Exemple #6
0
		protected override void RenderBeginTag(HtmlTextWriter writer)
		{
			var tagName = string.Empty;

			switch(this.RenderMode)
			{
				case ListRenderMode.List:
					tagName = "dl";
					break;
				case ListRenderMode.BulletList:
					tagName = "ul";
					break;
				case ListRenderMode.OrderedList:
					tagName = "ol";
					break;
			}

			if(!string.IsNullOrWhiteSpace(tagName))
			{
				if(!string.IsNullOrWhiteSpace(this.ID))
					writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID);

				if(!string.IsNullOrWhiteSpace(this.CssClass))
					writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);

				writer.RenderBeginTag(tagName);
			}

			if(_headerTemplate != null)
			{
				using(var literal = new Literal())
				{
					_headerTemplate.InstantiateIn(literal);
					literal.RenderControl(writer);
				}
			}
		}