Rectangle 27 5

in hotmail it's done with Silverlight.

there is a free (for now) flash upload control called Uploadify...

if I'm wrong please correct me! :)

javascript - AsyncFileUpload restrict file size to upload - Stack Over...

javascript asp.net ajax asyncfileupload
Rectangle 27 3

There is a simpler solution

@@t0x1n3Himself the solution u gave is very simple but does not work

surround the AsyncFileUpload with an update panel name it UpdatePanelAFU then in the UpdatePanelAFU do as the following :

protected void AsyncFileUpload_UpdatePanelAFU(object sender,AjaxControlToolkit.AsyncFileUploadEventArgs e)
{

    if (Request.Params.Get("__EVENTTARGET") != "UpdatePanelAFU")
        return;
..... rest of the code 
}

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 3

There is a simpler solution

@@t0x1n3Himself the solution u gave is very simple but does not work

surround the AsyncFileUpload with an update panel name it UpdatePanelAFU then in the UpdatePanelAFU do as the following :

protected void AsyncFileUpload_UpdatePanelAFU(object sender,AjaxControlToolkit.AsyncFileUploadEventArgs e)
{

    if (Request.Params.Get("__EVENTTARGET") != "UpdatePanelAFU")
        return;
..... rest of the code 
}

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 3

There is a simpler solution

@@t0x1n3Himself the solution u gave is very simple but does not work

surround the AsyncFileUpload with an update panel name it UpdatePanelAFU then in the UpdatePanelAFU do as the following :

protected void AsyncFileUpload_UpdatePanelAFU(object sender,AjaxControlToolkit.AsyncFileUploadEventArgs e)
{

    if (Request.Params.Get("__EVENTTARGET") != "UpdatePanelAFU")
        return;
..... rest of the code 
}

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 3

There is a simpler solution

@@t0x1n3Himself the solution u gave is very simple but does not work

surround the AsyncFileUpload with an update panel name it UpdatePanelAFU then in the UpdatePanelAFU do as the following :

protected void AsyncFileUpload_UpdatePanelAFU(object sender,AjaxControlToolkit.AsyncFileUploadEventArgs e)
{

    if (Request.Params.Get("__EVENTTARGET") != "UpdatePanelAFU")
        return;
..... rest of the code 
}

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 4

You can do this in the client side Upload Start event.

if (sender._inputFile.files[0].size >= maxFileSize) {
    sender._stopLoad();
}

javascript - AsyncFileUpload restrict file size to upload - Stack Over...

javascript asp.net ajax asyncfileupload
Rectangle 27 2

1) Add a css-hidden asp:Button bellow the asp:AsyncFileUpload AsyncFileUpload1 control.

<asp:Button runat="server" ID="btnClick" Text="Update grid" style="display:none"/>
Page_Load
else
if
AsyncFileUpload1_UploadedComplete
if (Request.Params.Get("__EVENTTARGET") != "UploadPostback")

4) Back to the aspx. Put a asp:UpdatePanel outside the grid GridView1.

<asp:UpdatePanel runat="server" UpdateMode="Conditional">
     <Triggers>
         <asp:AsyncPostBackTrigger ControlID="btnClick" EventName="Click" />
     </Triggers>
     <ContentTemplate>

     <asp:GridView ID="GridView1" ...
     YOUR GRID CODE REMAINS THE SAME
     </asp:GridView>

    </ContentTemplate>
</asp:UpdatePanel>

5) The last step is to change the AjaxUploadComplete client-side javascript function to make it trigger the postback. Replace it with the following:

function AjaxUploadComplete() {
    var btnClick = document.getElementById("btnClick");
    btnClick.click();
}

Any file the user selects is uploaded only once. All changes here are meant to be made in AjaxUpload.aspx & AjaxUpload.aspx.cs of your AjaxUpload.zip.

This wouldn't be quite what I would code to accomplish this kind of behavior, but I made the fewer possible changes so your goals would be met.

Thanks tiagoinu, your solution does the job. You rock!

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 2

1) Add a css-hidden asp:Button bellow the asp:AsyncFileUpload AsyncFileUpload1 control.

<asp:Button runat="server" ID="btnClick" Text="Update grid" style="display:none"/>
Page_Load
else
if
AsyncFileUpload1_UploadedComplete
if (Request.Params.Get("__EVENTTARGET") != "UploadPostback")

4) Back to the aspx. Put a asp:UpdatePanel outside the grid GridView1.

<asp:UpdatePanel runat="server" UpdateMode="Conditional">
     <Triggers>
         <asp:AsyncPostBackTrigger ControlID="btnClick" EventName="Click" />
     </Triggers>
     <ContentTemplate>

     <asp:GridView ID="GridView1" ...
     YOUR GRID CODE REMAINS THE SAME
     </asp:GridView>

    </ContentTemplate>
</asp:UpdatePanel>

5) The last step is to change the AjaxUploadComplete client-side javascript function to make it trigger the postback. Replace it with the following:

function AjaxUploadComplete() {
    var btnClick = document.getElementById("btnClick");
    btnClick.click();
}

Any file the user selects is uploaded only once. All changes here are meant to be made in AjaxUpload.aspx & AjaxUpload.aspx.cs of your AjaxUpload.zip.

This wouldn't be quite what I would code to accomplish this kind of behavior, but I made the fewer possible changes so your goals would be met.

Thanks tiagoinu, your solution does the job. You rock!

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 2

1) Add a css-hidden asp:Button bellow the asp:AsyncFileUpload AsyncFileUpload1 control.

<asp:Button runat="server" ID="btnClick" Text="Update grid" style="display:none"/>
Page_Load
else
if
AsyncFileUpload1_UploadedComplete
if (Request.Params.Get("__EVENTTARGET") != "UploadPostback")

4) Back to the aspx. Put a asp:UpdatePanel outside the grid GridView1.

<asp:UpdatePanel runat="server" UpdateMode="Conditional">
     <Triggers>
         <asp:AsyncPostBackTrigger ControlID="btnClick" EventName="Click" />
     </Triggers>
     <ContentTemplate>

     <asp:GridView ID="GridView1" ...
     YOUR GRID CODE REMAINS THE SAME
     </asp:GridView>

    </ContentTemplate>
</asp:UpdatePanel>

5) The last step is to change the AjaxUploadComplete client-side javascript function to make it trigger the postback. Replace it with the following:

function AjaxUploadComplete() {
    var btnClick = document.getElementById("btnClick");
    btnClick.click();
}

Any file the user selects is uploaded only once. All changes here are meant to be made in AjaxUpload.aspx & AjaxUpload.aspx.cs of your AjaxUpload.zip.

This wouldn't be quite what I would code to accomplish this kind of behavior, but I made the fewer possible changes so your goals would be met.

Thanks tiagoinu, your solution does the job. You rock!

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 2

1) Add a css-hidden asp:Button bellow the asp:AsyncFileUpload AsyncFileUpload1 control.

<asp:Button runat="server" ID="btnClick" Text="Update grid" style="display:none"/>
Page_Load
else
if
AsyncFileUpload1_UploadedComplete
if (Request.Params.Get("__EVENTTARGET") != "UploadPostback")

4) Back to the aspx. Put a asp:UpdatePanel outside the grid GridView1.

<asp:UpdatePanel runat="server" UpdateMode="Conditional">
     <Triggers>
         <asp:AsyncPostBackTrigger ControlID="btnClick" EventName="Click" />
     </Triggers>
     <ContentTemplate>

     <asp:GridView ID="GridView1" ...
     YOUR GRID CODE REMAINS THE SAME
     </asp:GridView>

    </ContentTemplate>
</asp:UpdatePanel>

5) The last step is to change the AjaxUploadComplete client-side javascript function to make it trigger the postback. Replace it with the following:

function AjaxUploadComplete() {
    var btnClick = document.getElementById("btnClick");
    btnClick.click();
}

Any file the user selects is uploaded only once. All changes here are meant to be made in AjaxUpload.aspx & AjaxUpload.aspx.cs of your AjaxUpload.zip.

This wouldn't be quite what I would code to accomplish this kind of behavior, but I made the fewer possible changes so your goals would be met.

Thanks tiagoinu, your solution does the job. You rock!

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 5

After wasting hours before discovering the bug mentioned by user554134, I came up with the following solution that uses jQuery (along with the asyncfileupload control).

$(document).ready(function () {
            $("#imgConfirmation").hide();
        });

The key point to remember is that the AsyncFileUpload control utilizes an iframe, so you need to have jquery access the parent of the frame when calling your "show" function. Eg:

function showImage(imagePath) {
            $('#imgConfirmation', window.parent.document).attr("src", imagePath);
            $('#imgConfirmation', window.parent.document).show();
        }
  • In your UploadedComplete event, after saving the file, register the client script to hook into the js function. Eg,
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "showImage", "showImage('" + myLink + "');", true);

Thanks! I had found the bug mentioned already but I still wasn't able to get my div/panel to show/hide the way I wanted. This did the trick. Too bad I didn't find this two days ago!

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

c# - asyncfileupload show image after upload without refreshing the pa...

c# asp.net ajax
Rectangle 27 3

After a few days, that's right, few day of debugging, I found this is a bug:

c# - asyncfileupload show image after upload without refreshing the pa...

c# asp.net ajax
Rectangle 27 1

I believe @Veera had it right. UploadComplete was being called multiple times as the file was uploading. The following worked for me.

void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e) {
    if (AsyncFileUpload1.IsUploading) return;
    // rest of your upload code
}

A little late here but I have the same issue and tried using IsUploading but I get "undefined" returned for AsyncFileUpload1.IsUploading (assuming the control ID was AsyncFileUpload1, wrapped in UpdatePanel)

Make sure you have the AsyncFileUpload control. Chances are you didn't get a reference to the control and it's NULL (nothing).

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 1

I believe @Veera had it right. UploadComplete was being called multiple times as the file was uploading. The following worked for me.

void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e) {
    if (AsyncFileUpload1.IsUploading) return;
    // rest of your upload code
}

A little late here but I have the same issue and tried using IsUploading but I get "undefined" returned for AsyncFileUpload1.IsUploading (assuming the control ID was AsyncFileUpload1, wrapped in UpdatePanel)

Make sure you have the AsyncFileUpload control. Chances are you didn't get a reference to the control and it's NULL (nothing).

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 1

I believe @Veera had it right. UploadComplete was being called multiple times as the file was uploading. The following worked for me.

void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e) {
    if (AsyncFileUpload1.IsUploading) return;
    // rest of your upload code
}

A little late here but I have the same issue and tried using IsUploading but I get "undefined" returned for AsyncFileUpload1.IsUploading (assuming the control ID was AsyncFileUpload1, wrapped in UpdatePanel)

Make sure you have the AsyncFileUpload control. Chances are you didn't get a reference to the control and it's NULL (nothing).

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload
Rectangle 27 1

I believe @Veera had it right. UploadComplete was being called multiple times as the file was uploading. The following worked for me.

void AsyncFileUpload1_UploadedComplete(object sender, AsyncFileUploadEventArgs e) {
    if (AsyncFileUpload1.IsUploading) return;
    // rest of your upload code
}

A little late here but I have the same issue and tried using IsUploading but I get "undefined" returned for AsyncFileUpload1.IsUploading (assuming the control ID was AsyncFileUpload1, wrapped in UpdatePanel)

Make sure you have the AsyncFileUpload control. Chances are you didn't get a reference to the control and it's NULL (nothing).

c# - AsyncFileUpload postback causes double upload - Stack Overflow

c# asp.net ajax gridview asyncfileupload