Avatar of Strychtur
Strychtur
Flag for Canada asked on

FileUploader for Image inside user control, inside accordion, inside update panel

Hi All,

As the tittle says, I have a FileUpload control in a user control. When the user clicks the upload button I want to upload the image into an image control in the same user control. The user control resides in an accordion control which also resides in an update panel set as update mode = conditional and child triggers = false.
The problem I'm have is when the upload button is clicked inside the user control  causing a postback
the FileUpload control looses the selected file. FileUpLoad.FileName = "" inside the click event function of the button. Why and how do I get around it?
AJAX

Avatar of undefined
Last Comment
Strychtur

8/22/2022 - Mon
leakim971

>Why
By design?

>how do I get around it?
Try to set the OnClientClick attribute of the button :
OnClientClick="return false"

Open in new window

Strychtur

ASKER
of the upload button?
Strychtur

ASKER
When I do that the upload click event does not fire.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
leakim971

>When I do that the upload click event does not fire.
So by design to upload the image your control need to do a postback

Go for an ASYNC FileUploader Control, for example : http://www.asp.net/ajax/ajaxcontroltoolkit/samples/asyncfileupload/asyncfileupload.aspx
Strychtur

ASKER
Thanks I looked at the link.
But I'm still unsure and you provide example to upload Image using ASYNC FileUploader Control. I don't need to save until user clicks save button on main page outside user control. In which case I need to save to SQL 2005 db. Right now I just need to display the image. Is the image loaded into memory then the image control or is loaded from file to image control?
Strychtur

ASKER
When I try I get an error file attached is invalid
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
leakim971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
GlobaLevel

can you separate the two events independently of each other...
Strychtur

ASKER
What do you mean? how?