RadControls version
|
Q3 2011 |
.NET version
|
4.0 |
Visual Studio version |
2010 |
programming language |
C# |
browser support |
all browsers supported by RadControls
|
PROJECT DESCRIPTION
This is my solution using RadAsyncUpload auto uploading images and display thumbnails with HighSlide
First add js scripts to use on Header tag
Create file "AsyncUpload.aspx" with code
In the code-behind
Then insert js code
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function DeleteFile(filePath) {
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
dataType: 'json',
url: '/AsyncUpload.aspx/DeleteFile',
data: "{'filePath': \"" + filePath + "\"}",
success: function (data) {
if (data.d) {
alert('Delete file successfully');
} else {
alert('Cannot delete file');
}
}
});
}
function onFilesUploaded(sender, args) {
$('#btnUpload').click();
var imageListContainer = $('#<%= txtImage.ClientID %>ListContainer li span.ruFileWrap');
$('#<%= txtImage.ClientID %>ListContainer li span.ruFileWrap').each(function (index) {
if (index <
imageListContainer.length
- 1) {
//alert($(this).children(".ruUploadSuccess").html());
var
fileName
=
"/Uploads/"
+ $(this).text();
$(this).addClass('temp_ruFileWrap');
$(this).children(".ruUploadSuccess").addClass('temp_ruUploadSuccess');
$(this).append(String.format("<a
href
=
'{0}'
title
=
''
class
=
'highslide'
onclick
=
'return hs.expand(this);'
><
img
class
=
'image-thumbnail'
src
=
'{0}'
alt
=
'{1}'
/></
a
>", fileName, fileName));
$(this).children(".ruUploadSuccess").text('');
}
});
}
function onFileUploadRemoving(sender, args) {
DeleteFile("/Uploads/" + args.get_fileName());
}
</
script
>
</
telerik:RadCodeBlock
>
Ok now you can run it :D Happy coding.
You can download my code follow link below
http://www.mediafire.com/?39oi5bqp4by3tpx