I'm trying to display images on my gridimagecolumn without me having to upload it myself but instead it does it automatically when i load the grid. How do I do that?
My template is =>
<telerik:GridBinaryImageColumn DataField=
"Profile"
HeaderText=
"Profile"
UniqueName=
"Upload"
ImageHeight=
"60px"
ImageWidth=
"60px"
ResizeMode=
"Fit"
></telerik:GridBinaryImageColumn>
I haven't yet figure the code out on how to go about this...This is what I have so far.
protected
void
uxUsedGrid_InsertCommand(
object
source, GridCommandEventArgs e)
{
_InsertCommand(source, e);
}
private
void
_InsertCommand(
object
source, GridCommandEventArgs e)
{
GridEditFormInsertItem insertItem = e.Item
as
GridEditFormInsertItem;
RadAsyncUpload radAsyncUpload = insertItem[
"Upload"
].FindControl(
"AsyncUpload1"
)
as
RadAsyncUpload;
UploadedFile file = radAsyncUpload.UploadedFiles[0];
byte
[] fileData =
new
byte
[file.InputStream.Length];
file.InputStream.Read(fileData, 0, (
int
)file.InputStream.Length);
}
protected
void
AsyncUpload1_FileUploaded(
object
sender, FileUploadedEventArgs e)
{
long
totalBytes = 0;
int
MaxTotalBytes = 1000000;
if
((totalBytes < MaxTotalBytes) && (e.File.ContentLength < MaxTotalBytes))
{
e.IsValid =
true
;
totalBytes += e.File.ContentLength;
IsRadAsyncValid =
true
;
}
else
{
e.IsValid =
false
;
IsRadAsyncValid =
false
;
}
}
I have look at this Demo and while it was helpful, it mostly focused on the client uploading the files and basing it off from that to upload the images.
Any help is appreciated!