Rank: Newbie
Groups: Member
Joined: 12/11/2009(UTC) Posts: 2
|
I have two user controls with one Image Uploader (ASP.NET control) each one and when I try to use those user controls in the same aspx page, one of the Image Uploader calls the another OnFileUploaded event. Is there any way to use multiple Image Uploader in the same page? Am I missing something? Thanks in advance.
PS: sorry for my english =P
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 3/9/2008(UTC) Posts: 554
Was thanked: 1 time(s) in 1 post(s)
|
Hi, I reproduced your problem locally. Unfortunately it is a bug, our developers will fix in future releases. As workaround I recommend you to use the following method. You need to send some ID to identify which Image Uploader sends a request and depend on this ID run appropriate code: Code:<script type="text/javascript">
function BeforeUpload1()
{
getImageUploader("<%=ImageUploader1.ClientID %>").AddField("ID", "ImageUploader1");
}
function BeforeUpload2()
{
getImageUploader("<%=ImageUploader2.ClientID %>").AddField("ID", "ImageUploader2");
}
</script>
<cc1:ImageUploader ID="ImageUploader1" runat="server"
Action="default.aspx"
OnFileUploaded="ImageUploader1_FileUploaded"
onclientbeforeupload="BeforeUpload1">
</cc1:ImageUploader>
<cc1:ImageUploader ID="ImageUploader2" runat="server"
//other params
Action="default.aspx"
OnFileUploaded="ImageUploader1_FileUploaded"
onclientbeforeupload="BeforeUpload2">
</cc1:ImageUploader>
Server-side handler: Code:private void ImageUploader1_FileUploaded(object sender, FileUploadEventArgs e)
{
string id = Request.Form["ID"];
if (id == "ImageUploader1")
{
// upload code for ImageUploader1
}
else
{
// upload code for ImageUploader2
}
}
I hope it helps you. |
|
|
|
|
Rank: Newbie
Groups: Member
Joined: 12/11/2009(UTC) Posts: 2
|
Thanks for the feedback Tamila! I've managed to "fix" this issue by dynamically loading the user control only when it's needed (I'm using tabs to differentiate the uploads). Lazy loading the controls only when they are needed help me to solve this issue, but your approach is correct too. Once again thank you very much for the feedback.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.