コード例 #1
0
        protected void lvAuthorList_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType != ListViewItemType.DataItem)
            {
                return;
            }

            Author author = e.Item.DataItem as Author;

            if (author == null)
            {
                return;
            }

            HyperLink hlAuthor = e.Item.FindControl("hlAuthor") as HyperLink;

            if (hlAuthor != null)
            {
                hlAuthor.Text        = author.FullName;
                hlAuthor.NavigateUrl = AuthorManager.GetAuthorViewUrl(author.FullName, settingsItem);

                Literal litProfileImage = e.Item.FindControl("litProfileImage") as Literal;

                if (litProfileImage != null && author.ProfileImage != null && author.ProfileImage.MediaItem != null && settingsItem.AuthorListDisplayImage)
                {
                    litProfileImage.Text = String.Format("<img src=\"{0}?mw={1}\" border=\"0\" />", MediaManager.GetMediaUrl(author.ProfileImage.MediaItem), settingsItem.AuthorViewImageMaxWidth);
                }
            }
        }
コード例 #2
0
ファイル: AuthorViewList.ascx.cs プロジェクト: gillissm/XBlog
        protected void lvAuthorList_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType != ListViewItemType.DataItem)
            {
                return;
            }

            Author author = e.Item.DataItem as Author;

            if (author == null)
            {
                return;
            }

            HyperLink hlAuthor = e.Item.FindControl("hlAuthor") as HyperLink;

            if (hlAuthor != null)
            {
                string itemID       = author.ItemId.ToString();
                string countDisplay = "";
                if (authorCount.ContainsKey(itemID) && settingsItem.DisplayCountOnTagList)
                {
                    countDisplay = String.Format(" ({0})", authorCount[itemID].ToString());
                }

                hlAuthor.Text        = author.FullName + countDisplay;
                hlAuthor.NavigateUrl = AuthorManager.GetAuthorViewUrl(author.FullName, settingsItem);

                Literal litProfileImage = e.Item.FindControl("litProfileImage") as Literal;

                if (litProfileImage != null && author.ProfileImage != null && author.ProfileImage.MediaItem != null && settingsItem.AuthorListDisplayImage)
                {
                    litProfileImage.Text = String.Format("<img src=\"{0}?mw={1}\" border=\"0\" />", MediaManager.GetMediaUrl(author.ProfileImage.MediaItem), settingsItem.AuthorListImageMaxWidth);
                }
            }
        }