Trying to get asp:PlaceHolder to work with NeatUpload

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Trying to get asp:PlaceHolder to work with NeatUpload

Loc Pham
Hi everyone,

Did anyone tried to have a PlaceHolder controller in conjunction with NeatUpload's progress bar?  I kept on getting a NullReference exception and can't figure out the reason.

Here is my code:


        <Upload:ProgressBar ID="ProgressBar1" runat='server' Inline="true" Triggers="Button1">
        <Upload:InputFile ID="NU_InputFile1" runat="server" />
        <asp:Button ID="Button1" runat="server" Text="Upload" />
        <asp:PlaceHolder runat="server" ID="File1ThumbnailPlaceHolder"></asp:PlaceHolder>           


        protected void Page_Load(object sender, EventArgs e)
            Button1.Click += new System.EventHandler(this.UploadBtn1_Clicked);

        protected void UploadBtn1_Clicked(object sender, EventArgs e)
            if (IsValid && NU_InputFile1.HasFile)
                    Bitmap img = new Bitmap(NU_InputFile1.FileContent);
                    HttpContext.Current.Session["PrimaryImage"] = img;
                    // Display image from Session variable on previous line.
                    System.Web.UI.WebControls.Image imgTmp = new System.Web.UI.WebControls.Image();
                    imgTmp.ImageUrl = "ImageHandler.ashx?ID=" + 1;
                catch(Exception exc){...}

The idea is to try to store the Uploaded image into session variable then resize the image inside the .ashx handler and display the new resized image on the PlaceHolder's ImageUrl.

I placed break points inside the .ashx file and noticed it didn't even execute the .ashx handler file.  However, after File1ThumbnailPlaceHolder.Controls.Add(imgTmp) runs, it threw an exception which the catch statement didn't caught.... The exception then finally caught inside Global.asax.cs Application_Error().

Please advice.  I'm stuck here and can't proceed.
Thanks in advance,
Reply | Threaded
Open this post in threaded view

Re: Trying to get asp:PlaceHolder to work with NeatUpload

Hi, Loc.
Have you ever worked it out? How does the code work? When it comes to the image resizing problem, I have another question for you. I wonder how can I accomplish the image resizing process. Do I need another image resizing SDK to help change the size of images? I am almost a green hand here. Any suggestion will be appreciated. Thanks in advance.    

Best regards,
Tags: resize image
Best Regards,

Next Tomorrow is Another Day.