예제 #1
0
        //IMAGE (GRIDVIEW)(end)
        //*****************************************************
        //*****************************************************

        //(EVENT) DROPDOWNLIST (project folder) selection changes
        protected void DropDownListProjName_SelectedIndexChanged(object sender, EventArgs e)
        {
            //set current project (if changes)
            //ProjectFolder.SetCurrentProject()

            //reload files
            FileManager.ReloadFiles(DropDownListProjName, DropDownListXML);      //reload (files) if (project name) changes

            //current project
            //current XML file
            string file = Path.GetFileName(DropDownListXML.Text);

            if (file == "")
            {
                NotificationLabel.Text = String.Format("Go to the <b>Settings</b> menu to upload files.", file);
            }
            else
            {
                //NotificationLabel.Text = String.Format("Current XML file: <b>{0}</b>", file);
                NotificationLabel.Text = String.Format("Current project: <b>{0}</b>", ProjectFolder.GetCurrentProject());
            }
        }
예제 #2
0
        //ADDS IMAGE (TO GRIDVIEW)(or hides depending)
        public void AddImageToGridView()
        {
            //current project
            string currentProject = ProjectFolder.GetCurrentProject();

            //test (image folder exists)
            string imagePath = ProjectFolder.GetAspFolder() + "images\\" + currentProject;
            bool   testIfImageFolderExists = ImageFolderExists(imagePath);

            //test (image column exists)
            bool testIfColumnExists = TestColumn("Thumbnail");

            //get button column (image toggle)
            //int imageBtnIndex = GetColumn("Image Toggle");
            int imageBtnIndex = GetColumn("Toggle");

            //get column index
            int columnIndex = GetColumn("Thumbnail");
            //DataControlField cntl;
            ImageField img;

            //image path "/images/defaultProject/{0}"
            string imageAttrPath = "/images/" + currentProject + "/{0}";    //the {0} binds to Image column 'Piping/cd00001.jpg' (DataImageUrlField)

            //only do this if image folder exists (user needs to upload images)
            if (testIfImageFolderExists)
            {
                if (!testIfColumnExists)
                {
                    //(add) image column field
                    //ImageField img = new ImageField();
                    img = new ImageField();
                    img.DataImageUrlField = "Image";

                    //img.DataImageUrlFormatString = "/images/defaultProject/{0}";
                    img.DataImageUrlFormatString = imageAttrPath;
                    //img.DataImageUrlFormatString = imageAttrPath;

                    img.ControlStyle.Width  = 80;
                    img.ControlStyle.Height = 50;

                    img.AlternateText = "Clash Image";
                    img.HeaderText    = "Thumbnail";

                    //img.NullDisplayText = "Image not found, please load images from the settings menu.";
                    //img.NullImageUrl = "/images/404ImageNotFound.png";

                    img.Visible = true;                                             //show image
                    gvClashResult.Columns[imageBtnIndex].Visible = true;            //show button

                    gvClashResult.Columns.Add(img);
                }
                else
                {
                    //cntl = gvClashResult.Columns[columnIndex];
                    //ImageField img = (ImageField)gvClashResult.Columns[columnIndex];
                    img = (ImageField)gvClashResult.Columns[columnIndex];

                    //img.DataImageUrlFormatString = "/images/defaultProject/{0}";
                    img.DataImageUrlFormatString = imageAttrPath;

                    //need to push the WIDTH and HEIGHT (seems to be stripping out the attributes when dropdown changes)
                    img.ControlStyle.Width  = 80;
                    img.ControlStyle.Height = 50;

                    img.Visible = true;                                             //show image
                    gvClashResult.Columns[imageBtnIndex].Visible = true;            //show button
                }
            }
            //do this if there are (no image folder)
            else
            {
                //(remove) any image columns from previous project
                if (testIfColumnExists)
                {
                    //(hide) image column and button
                    img = (ImageField)gvClashResult.Columns[columnIndex];

                    //need to push the WIDTH and HEIGHT (seems to be stripping out the attributes when dropdown changes)
                    img.ControlStyle.Width  = 80;
                    img.ControlStyle.Height = 50;

                    img.Visible = false;                                             //hide image
                    gvClashResult.Columns[imageBtnIndex].Visible = false;            //hide button
                }
            }
        }