Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int downloadRowCount = 0;

            // detect formats based on first file found
            string column1format = null;
            string column2format = null;

            // hide unused rows
            for (short i = 1; i <= 40; i++)
            {
                string idNum = i.ToString(CultureInfo.InvariantCulture);
                if (idNum.Length == 1)
                {
                    idNum = "0" + idNum;                    // add leading 0
                }
                HtmlTableRow row = FindControl("row" + idNum) as HtmlTableRow;
                if (row != null)
                {
                    var fileExtension = GetFileExtensionFromPlaceholder("phFile" + idNum, this);
                    row.Visible = (!String.IsNullOrEmpty(fileExtension));
                    if (row.Visible)
                    {
                        // detect formats based on first file found
                        if (column1format == null)
                        {
                            column1format = fileExtension;
                        }
                        else
                        {
                            this.column1FormatIsConsistent = (this.column1FormatIsConsistent && (column1format == fileExtension || String.IsNullOrEmpty(fileExtension)));
                        }

                        fileExtension = GetFileExtensionFromPlaceholder("phFile" + idNum + "a", this);
                        if (column2format == null)
                        {
                            column2format = fileExtension;
                        }
                        else
                        {
                            this.column2FormatIsConsistent = (this.column2FormatIsConsistent && (column2format == fileExtension || String.IsNullOrEmpty(fileExtension)));
                        }
                        downloadRowCount++;
                    }
                }
            }

            // hide unused column
            HideUnusedColumn(this, column2format);

            if (downloadRowCount == 0)
            {
                downloadList.Visible = false;
            }

            // show formats in column headers
            this.col1head.InnerHtml = "<span class=\"" + FileFormatCssClass(column1format) + "\">" + Server.HtmlEncode(FileFormatName(column1format)) + "</span>";
            this.col0.InnerHtml     = "<span class=\"" + FileFormatCssClass(column2format) + "\">" + Server.HtmlEncode(FileFormatName(column2format)) + "</span>";

            image1.Visible = (phImage01.HasContent);
            CmsUtilities.ShowCaption(phImage01.PlaceholderToBind, "phDefAltAsCaption01", caption01, alt01);
        }