This is a migrated thread and some comments may be shown as answers.

Uploading even on postback

4 Answers 55 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
hari prasad ananthuni
Top achievements
Rank 1
hari prasad ananthuni asked on 20 Nov 2009, 11:23 AM
Hello all,
        I'm using Rad upload control with rad progressarea and rad progress manager in a user control. 

 

 

<%

@ Control Language="C#" AutoEventWireup="true" Inherits="wucPreliminaryPlans" CodeBehind="wucPreliminaryPlans.ascx.cs" %>

 

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

 

 

<

 

table>

 

 

<tr>

 

 

<td>

 

 

<telerik:RadUpload ID="rdupload" runat="server" ControlObjectsVisibility="None"

 

 

MaxFileInputsCount="1"

 

 

OverwriteExistingFiles="false" TargetFolder="~/Uploads/MyFiles"

 

 

OnFileExists="rdupload_FileExists">

 

 

</telerik:RadUpload>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<asp:Button id="buttonSubmit" runat="server" OnClick="buttonSubmit_Click" text="Submit" />

 

 

<asp:Label ID="labelNoResults" runat="server" Visible="True">No uploaded files yet</asp:Label>

 

 

</td>

 

 

</tr>

 

 

 

<tr><td>

 

 

<telerik:RadProgressManager ID="rdUploadProgressManager" runat="server" />

 

 

<telerik:RadProgressArea ID="rdUploadProgress" runat="server" Language=""

 

 

ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, RequestSize, FilesCountBar, FilesCount, FilesCountPercent, SelectedFilesCount, TimeElapsed, TimeEstimated, TransferSpeed"

 

 

Skin="Vista" >

 

 

<Localization Uploaded="Uploaded"></Localization>

 

 

</telerik:RadProgressArea>

 

 

</td>

 

 

</tr>

 

 

 

</table>

 




Code behind.



 

 

protected

 

void Page_Load(object sender, EventArgs e)

 

{

 

if (!IsPostBack)

 

{

 

//Do not display SelectedFilesCount progress indicator.

 

 

 

 

 

rdUploadProgress.ProgressIndicators &= ~

ProgressIndicators.SelectedFilesCount;

 

}

}




 

protected

 

void buttonSubmit_Click(object sender, System.EventArgs e)

 

{

 

if (rdupload.UploadedFiles.Count>0)

 

{

labelNoResults.Text =

"Thanks for Uploading";

 

 

}

 

else

 

 

 

 

 

{

labelNoResults.Text =

"No files to upload";

 

}

}


 

it is working fine for even i click the upload btn.

But problem arises whenever my page is postback and if i have a value in the rad upload ,
it is uploading automatically.

Is there anyway to stop this.

Thanks,
Hari.

 

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 23 Nov 2009, 08:41 PM
This article helped me when I ran into the same issue :)
0
hari prasad ananthuni
Top achievements
Rank 1
answered on 27 Nov 2009, 07:14 AM
thank you for the reply,
       That was a gud article,
But the problem is . my control is in one of the wizard steps of asp: wizard control.

So whenever i click the other wizard step , my file is uploading , as it causing postback and facing the same problem

Hari.
0
Genady Sergeev
Telerik team
answered on 27 Nov 2009, 07:53 AM
Hello hari prasad ananthuni,

The help article provided in the previous post should help you solve your problem. The idea is to clear the value of the fileinput if the postback was triggered by a button different than the upload one. The workaround works in a asp wizard  as well.

Regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Nick
Top achievements
Rank 1
answered on 03 Dec 2009, 06:25 PM
Hello,

I have the same problem accept I have 2 user controls on the page.  One with the upload control and its upload button and another that has a couple buttons that post back.  The buttons that post back in the second user control are causing an upload if there is a file selected.  Is there anyway to avoid this in my situation?

Any help is greatly appreciated.
Thank you,
Nick
Tags
Upload (Obsolete)
Asked by
hari prasad ananthuni
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
hari prasad ananthuni
Top achievements
Rank 1
Genady Sergeev
Telerik team
Nick
Top achievements
Rank 1
Share this question
or