A ready-to-use ASCX control that provides advanced image uploading features.
Inheritance: System.Web.UI.UserControl, IPostBackDataHandler
Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            myPageInstance = this;
            imgUpload      = ImageUploader;
            myList         = lstvFamily;
            myTextBox      = nextID;
            myUpdatePanel  = UpdatePanel1;


            searchText.Focus();

            if (!this.IsPostBack)
            {
                string fileName            = "dummy";
                string sourceImageFilePath = "~/uploadedImg/" + fileName + ".jpg";
                imgUpload.LoadImageFromFileSystem(sourceImageFilePath);

                //imgUpload.UnloadImage();


                DrpListLoad();
            }

            //ListLoad();

            parameter = Request["__EVENTARGUMENT"];
            if (parameter != null && parameter != "")
            {
                int spliterInt = parameter.IndexOf(":,:");
                if (spliterInt > 0)
                {
                    string searchBy      = parameter.Substring(0, spliterInt);
                    string searchKeyword = parameter.Substring(spliterInt + 3);


                    switch (searchBy)
                    {
                    case "familyName":
                        myDS.Tables[0].DefaultView.RowFilter = searchBy.Trim() + " like '*" + searchKeyword.Trim() + "*'";
                        break;

                    case "familyID":
                        myDS.Tables[0].DefaultView.RowFilter = searchBy.Trim() + " = " + int.Parse(searchKeyword.Trim());
                        break;
                    }

                    myList.DataSource = myDS.Tables[0].DefaultView;
                    myList.DataBind();
                }
                else
                {
                    myList.DataSource = myDS.Tables[0];
                    myList.DataBind();
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            imgUpload = ImageUploader;

            if (!this.IsPostBack)
            {
                string fileName            = "dummy";
                string sourceImageFilePath = "~/uploadedImg/" + fileName + ".jpg";
                ImageUploader.LoadImageFromFileSystem(sourceImageFilePath);
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            myPageInstance = this;
            imgUpload      = ImageUploader;
            myList         = lstvFormat;
            myUpdatePanel  = UpdatePanel1;


            if (!this.IsPostBack)
            {
                string fileName            = "dummy";
                string sourceImageFilePath = "~/uploadedImg/" + fileName + ".jpg";
                imgUpload.LoadImageFromFileSystem(sourceImageFilePath);

                //imgUpload.UnloadImage();

                ListLoad();
            }
        }
    protected void Picture1_ImageUpload(object sender, SimpleImageUpload.ImageUploadEventArgs args)
    {
        this.MyLogEvent("New image uploaded.");

        if ((this.Picture1.SourceImageSize.Width < 100) || (this.Picture1.SourceImageSize.Height < 150))
        {
            // The uploaded image is too small
            this.Picture1.UnloadImage();
            this.Picture1.SetCurrentStatusMessage("<span style=\"color:#cc0000;\">The uploaded Image is too small.</span>");
            return;
        }

        if ((this.Picture1.SourceImageSize.Width > 1500) || (this.Picture1.SourceImageSize.Height > 1600))
        {
            // The uploaded image is too large
            this.Picture1.UnloadImage();
            this.Picture1.SetCurrentStatusMessage("<span style=\"color:#cc0000;\">The uploaded Image is too large.</span>");
            return;
        }
    }
 protected void Picture1_SelectedConfigurationIndexChanged(object sender, SimpleImageUpload.SelectedConfigurationIndexChangedEventArgs args)
 {
     // Apply the new crop constraint
     args.CropConstraint = this.GetCropConstraint(this.Picture1.SelectedConfigurationIndex.Value);
 }
 protected void Picture1_ImageUpload(object sender, SimpleImageUpload.ImageUploadEventArgs args)
 {
     // Auto-Apply the right crop constraint depending on the source image size
     if (this.Picture1.SourceImageSize.Width > this.Picture1.SourceImageSize.Height)
     {
         // Landscape -> Configuration = 0
         this.Picture1.SelectedConfigurationIndex = 0;
     }
     else
     {
         // Portrait -> Configuration = 1
         this.Picture1.SelectedConfigurationIndex = 1;
     }
     args.CropConstraint = this.GetCropConstraint(this.Picture1.SelectedConfigurationIndex.Value);
 }
 protected void ImageUpload1_ImageUpload(object sender, SimpleImageUpload.ImageUploadEventArgs args)
 {
     if (this.ImageUpload1.SourceImageSize.Width < 250)
     {
         // The uploaded image is too small
         this.ImageUpload1.UnloadImage();
         this.ImageUpload1.SetCurrentStatusMessage("<span style=\"color:#cc0000;\">Image width must be at least 250 px.</span>");
         return;
     }
 }