How to programmatically create UpdatePanel with FileUpload?

Discussion in 'ASP .Net' started by Bogdan, Aug 9, 2009.

  1. Bogdan

    Bogdan Guest

    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
     
    Bogdan, Aug 9, 2009
    #1
    1. Advertising

  2. Bogdan

    bruce barker Guest

    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)



    Bogdan wrote:
    > 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
    >
    >
     
    bruce barker, Aug 9, 2009
    #2
    1. Advertising

  3. Bogdan

    Bogdan Guest

    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


    "bruce barker" <> wrote in message
    news:%...
    >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)
    >
    >
    >
    > Bogdan wrote:
    >> 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
    >>
     
    Bogdan, Aug 10, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    497
  2. GaryDean

    FileUpload Control within UpdatePanel

    GaryDean, May 4, 2008, in forum: ASP .Net
    Replies:
    6
    Views:
    614
    Anil Abraham
    May 28, 2008
  3. Mario

    FileUpload in UpdatePanel

    Mario, Jun 1, 2010, in forum: ASP .Net
    Replies:
    1
    Views:
    540
  4. Ne7ven
    Replies:
    0
    Views:
    1,795
    Ne7ven
    Apr 18, 2011
  5. Jeremy

    fileupload fails in updatepanel

    Jeremy, Dec 12, 2007, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    246
    PJ on Development
    Dec 17, 2007
Loading...

Share This Page