Have an account?

» Forgot your username or password?

» Register for Free

Piczard v1.x Support Forum Archive


The Piczard v1.x Support Forum is no longer active. This is a static read-only copy of it.
It's not possible to post new messages or replies.
Search | Active Topics

Losing multiple images when one is replaced
thomashdbs
#1 Posted : Wednesday, November 27, 2013 11:26:30 AM(UTC)
Rank: Newbie

Joined: 11/27/2013(UTC)
Posts: 1
Points: 3

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hi,

I am having problems when I have multiple Piczard Image Uploaders on the page.

I am using v1.2.3.3 on ASP.NET v4.0.

I have three SimpleImageUpload controls inside a FormView. Within the DataBound event, I load an existing JPEG image into each control using the LoadImageFromFileSystem method. This works as expected, with the images appearing in the controls as expected.

If I then upload an image using any of the uploaders to replace an existing image, the other image uploaders lose their images on the page refresh.

If I upload a further image, then the first image I uploaded is still present in its image uploader, so I presume something isn't being set when I load an image from the code-behind.

Any advice on how I may solve this issue?

I can provide code snippets if necessary.
sergioturolla
#2 Posted : Thursday, November 28, 2013 8:42:12 AM(UTC)

Rank: Administration

Joined: 3/11/2011(UTC)
Posts: 159
Points: 489

Thanks: 0 times
Was thanked: 28 time(s) in 28 post(s)
Hi,

Yes, in order to help you I need to recreate the issue.
Please post some code snippet (markup + code behind).

If you won't publish it, you can send the code via a private message.

Thank you

Sergio
sergioturolla
#3 Posted : Thursday, November 28, 2013 1:31:19 PM(UTC)

Rank: Administration

Joined: 3/11/2011(UTC)
Posts: 159
Points: 489

Thanks: 0 times
Was thanked: 28 time(s) in 28 post(s)
You have just found a bug.
There is a problem with Page.PreRender event.

For some reason the event is NOT raised when the page is first loaded (IsPostBack = false)
... and it is raised after a postback !! (IsPostBack = true).

In order to bypass the problem, you have to edit the file "SimpleImageUpload.ascx.cs".
Locate the method "OnPreRender" and add the following line:

Code:
this.Page.ClientScript.RegisterHiddenField(this.popupPictureTrimmer1.ClientID + "_dhf", this.popupPictureTrimmer1.ClientID);


Example:

Code:
protected override void OnPreRender(EventArgs e)
{
    this.Page.ClientScript.RegisterHiddenField(this.popupPictureTrimmer1.ClientID + "_dhf", this.popupPictureTrimmer1.ClientID);
    ...
    ...
}


Kind regards

Sergio
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.