FileUploader inside AJAX update panel

Feb 24, 2009 at 11:55 AM

My schenario is something like this-

1. I have a class in my BusinessObject, which defines custom Adapter for the control.
2. I have created user control in my application (i.e. presentation layer) as follows-


@ Register TagPrefix="cust" Namespace="BusinessObject.CustomFileUploadAdapter" Assembly="BusinessObject" %>
<script type="text/javascript" language="javascript">
function PositionFilesListFunc(uploader)
   var pos = Flajaxian.positionFilesList(uploader);
   // you can change the default position, for example to shift 5px up and 10px right
   pos.x = 1;
   pos.y = 40;
   return pos;


function FileStateChanged(uploader, file, httpStatus, isLast)
    Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
//    var t = Flajaxian.$("MyDiv");
    if(file.state == Flajaxian.File_Uploaded && isLast)
        //t.innerHTML += "bytes:"+file.bytes+" name:"" state:"+file.state+" httpStatus:"+httpStatus+" isLast:"+isLast+"</br>";
        var objDiv = document.getElementById("divAttachments");
        var objHidden = document.getElementById("ctl00_ContentPlaceHolder1_hiddenAttachments");
        var objDivGrey = document.getElementById("grey");
       = 'none'; = 'hidden';
        var genmode = document.getElementById('ctl00_ContentPlaceHolder1_hMode_General');       
        if((genmode.value == 1) || (genmode.value == 2))
            mnuMain.GetItem(0).SetEnabled(false);    //New
            mnuMain.GetItem(1).SetEnabled(false);    //Delete
            mnuMain.GetItem(2).SetEnabled(true);     //Save
            mnuMain.GetItem(3).SetEnabled(false);    //Print
            mnuMain.GetItem(4).SetText('Cancel');    //Close



   <fjx:FileUploader ID="FileUploader1" runat="server" UseInsideUpdatePanel="true" CssUrl="~/css/fileuploader.css" RequestAsPostBack="true"
        JsFunc_PositionFilesList="PositionFilesListFunc" JsFunc_FileStateChanged="FileStateChanged"
            <cust:CustomFileUploadAdapter />


3. I am going to use the above user control in my webpage under DIV tag which I will show/hide dynamically based on button click on parent form.

Now, when button is clicked the div appears and from where user can upload the files into database. Once user clicks on "Upload" button, the grid in the parent form should get refreshed and should show the newly uploaded files.

How can I do this?