itemphotoimage.cs

来自「一个ASP.NET下的中文内容管理和社区系统」· CS 代码 · 共 59 行

CS
59
字号

namespace ASPNET.StarterKit.Communities {
    using System;
    using ASPNET.StarterKit.Communities.PhotoGallery;


    //*********************************************************************
    //
    // ItemPhotoImage Class
    //
    // Represents a photogallery image
    //
    //*********************************************************************
    public class ItemPhotoImage : ItemImage {


        public ItemPhotoImage() : base() {
            CssClass = "itemPhotoImage";
            EnableViewState = false;
        }


        //*********************************************************************
        //
        // OnDataBinding Method
        //
        // When databound, get the image information
        //
        //*********************************************************************
        override protected void OnDataBinding(EventArgs e) {
            ContentItem item;

            if (NamingContainer is ContentItem)
                item = (ContentItem)NamingContainer;
            else
                item = (ContentItem)NamingContainer.NamingContainer;

            SectionInfo objSectionInfo = (SectionInfo)Context.Items["SectionInfo"];


            PhotoInfo objPhotoInfo = (PhotoInfo)item.DataItem;
            if (objPhotoInfo.ImageID != -1) {
                if (objSectionInfo.ID == objPhotoInfo.SectionID) {
                    ImageUrl = ImageUtility.BuildImagePath(objPhotoInfo.ImageID, objPhotoInfo.ImageName);
                    NavigateUrl = CommunityGlobals.CalculatePath(String.Format("{0}.aspx", objPhotoInfo.ContentPageID));
                } else {
                    ImageUrl = ImageUtility.BuildFullImagePath(objPhotoInfo.SectionID, objPhotoInfo.ImageID, objPhotoInfo.ImageName);
                    NavigateUrl = ContentPageUtility.CalculateContentPath(objPhotoInfo.SectionID, objPhotoInfo.ContentPageID);
               
                }
            }
        }




    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?