How to programmatically create UpdatePanel with FileUpload?

B

Bogdan

Hi,

I need to programmatically create UpdatePanel with FileUpload control. The
problem is that for FileUpload control to function properly in UpdatePanel
it needs a post back trigger. Unfortunately, according to docs, you cannot
programmatically add triggers to UpdatePanel.
Does that mean that it is impossible to programmatically create UpdatePanels
with FileUpload controls?

Thanks,
Bogdan
 
B

bruce barker

a fileupload will not work in an update panel unless it does a full
postback (javascript cannot access a file on the disk). you csn have an
update panel render a fileupload, but you need it to do a form.submit()
from javascript (and be sure the form type is correct) or call the click
event of a button outside the panel.

-- bruce (sqlwork.com)
 
B

Bogdan

Bruce,

Thanks for the reply.

If I got it right, the full postback can be achieved by adding a trigger to
an UpdatePanel. Am I right? But, unfortunately, it seems that adding a
trigger to UpdatePanel can only be done declaratively and not
programmatically.

I have a page with one or more small areas dedicated to uploading of files.
Each area initially displays choices and then - based on a choice - either a
file upload control or other controls (listbox, editbox, etc.). It seems
like UpdatePanel would be an ideal choice for the area. I don't think I'd
have a problem with implementing it declaratively. When a FileUpload
control is shown I'd simply assign a postback trigger to Upload button that
I place beside the file upload control. That it turn would result in a full
postback.

But, I can't assign a trigger programmatically. Any ideas?

Thanks again,
Bogdan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top