Example #1
0
        /// <summary>
        /// Handles the ItemDataBound event of the dlFiles control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.DataListItemEventArgs"/> instance containing the event data.</param>
        void dlFiles_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Download  download   = e.Item.DataItem as Download;
                HyperLink hlDownload = e.Item.FindControl("hlDownload") as HyperLink;
                System.Web.UI.WebControls.Image imgIcon = e.Item.FindControl("imgIcon") as System.Web.UI.WebControls.Image;

                if (hlDownload != null)
                {
                    hlDownload.Text        = download.Title;
                    hlDownload.NavigateUrl = string.Format("~/download.ashx?did={0}", download.DownloadId);
                }
                if (imgIcon != null)
                {
                    imgIcon.ImageUrl = string.Format("~/App_Themes/dashCommerce/images/icons/{0}.gif", DownloadController.GetFileTypeIcon(Path.GetExtension(download.DownloadFile)));
                }
            }
        }