Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Ajax Uploader
»
Re: Fire asp.net codebehind after upload
Re: Fire asp.net codebehind after upload
09-06-2009, 11:11 PM
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Fire asp.net codebehind after upload
Reply
Quote
Hi calmusz,
Try this example
<%@ Page Language=
"C#"
%>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<script runat=
"server"
>
int
count;
protected
void
Uploader1_FileUploaded(
object
sender, UploaderEventArgs args)
{
count++;
if
(count ==
int
.Parse(Hidden1.Value))
{
Complete();
}
}
void
Complete()
{
//will fire after uploader complete
ClientScript.RegisterClientScriptBlock(
this
.GetType(),
"showcount"
,
"<script>alert('"
+ Hidden1.Value +
"')</"
+
"script>"
);
}
</script>
<html xmlns=
"http://www.w3.org/1999/xhtml"
>
<head runat=
"server"
>
<title>Untitled Page</title>
</head>
<body>
<form id=
"form1"
runat=
"server"
>
<CuteWebUI:Uploader ID=
"Uploader1"
runat=
"server"
OnFileUploaded=
"Uploader1_FileUploaded"
MultipleFilesUpload=
"true"
>
</CuteWebUI:Uploader>
<input id=
"Hidden1"
type=
"hidden"
runat=
"server"
/>
<asp:Label ID=
"label1"
runat=
"server"
></asp:Label>
</form>
</body>
</html>
<script type=
"text/javascript"
>
function CuteWebUI_AjaxUploader_OnSelect(files)
{
var hidden1=document.getElementById(
'<%= Hidden1.ClientID%>'
);
hidden1.value=files.length;
}
</script>
Regards,
Ken
View Complete Thread