Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Created Issue: Asyncfile upload control "UploadedComplete" event called on every postback [27171]

$
0
0
Hi,
I posted this issue in asp.net AjaxControlToolkit forum. But after confirming that this is real issue, I am posting posting the issue here.

I had a page where I have to update user's profile including profile image. I have placed asynFileUpload control to update the profile image & there are other several fields ike name, email, gender etc, to update the user information.

When my pages loads first & I update the profile image, it works fine (asynchronously,). Now, i fill other fields & press save button, my page posted back, click event of button fires & all information saved successfuly.

but now after firing the button click event, UploadedComplete event of asyncFileUpload control fires again & runs the whole code again to upload the image.

& this is happening in every post back. I am wondering how it is possible?

codes are given below:

<script type="text/javascript">
function uploadError(sender, args) {

alert("Error");
}
function uploadComplete(sender, args) { alert("Success");
}
</script>

<div class="rptRowL">
<div class="ui-widget-content ui-corner-all" style="width: 83px; height: 83px; float: right;">
<img id="imgMemberImage" runat="server" src="" alt="" />
</div>
</div>
<div class="rptRowR">
<strong>Change profile image</strong>:<br />
<Ajax:AsyncFileUpload OnClientUploadError="uploadError" OnClientUploadComplete="uploadComplete"
OnUploadedComplete="asynMemberFileUpload_UploadedComplete" OnUploadedFileError="asynMemberFileUpload_UploadedFileError"
runat="server" ID="asynMemberFileUpload" Width="400px" UploaderStyle="Modern"
UploadingBackColor="#CCFFFF" ThrobberID="myThrobber" />
<br />
<asp:Label runat="server" ID="myThrobber" Style="display: none;"><img align="absmiddle" alt="" src="../Images/uploading.gif" /></asp:Label>
</div>




protected void asynMemberFileUpload_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
{
// Code to process the image which is running fine.
}


protected void asynMemberFileUpload_UploadedFileError(object sender, AsyncFileUploadEventArgs e)
{
// Code to show the error if any (running fine)
}

protected void btnSave_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
// Code to process the other details (running fine)
}
}

problem is: after firing the click event of button, asyncFileUpload's uploadedcomplete event fires in every postback.
How can I prevent this?

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>