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

GridBinaryImageColumn value in grid with Batch Edit

1 Answer 28 Views
Grid
This is a migrated thread and some comments may be shown as answers.
readyweb
Top achievements
Rank 1
readyweb asked on 21 Nov 2013, 04:47 PM
Hello,

I´ve a Radgrid with GridBinaryImageColumn workin in batch edit mode.

In the BatchEditCommand, I am not able to get the binary value of the image and I can not upload control access to try to get it.

I've tried to make using the properties UploadControlType Async and normal

Can you upload an example of how you solve this problem?

Thank you very much.

Regards

1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 26 Nov 2013, 09:45 AM
Hello,

Our developers are currently working on the integration of the GridBinaryImageColumn with the BatchEditMode. In the next version the uploaded file will be directly available in the newValues collection in the arguments. For now in order to extract the data you should obtain a reference to the upload control which is rendered as an editor and extract the file from it's UploadedFiles collection:

C#:
protected void RadGrid1_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
    {
        RadAsyncUpload asyncUpload=(RadGrid1.MasterTableView.GetBatchColumnEditor("UploadColumnName") as GridBinaryImageColumnEditor).RadAsyncUploadControl;
        foreach (GridBatchEditingCommand command in e.Commands)
        {
            foreach (UploadedFile uploadedFile in asyncUpload.UploadedFiles)
            {
                if (uploadedFile.FileName == command.NewValues["UploadDataField"].ToString())
                {
                    System.IO.Stream stream = uploadedFile.InputStream;
                    byte[] buffer = new byte[stream.Length];
                    stream.Read(buffer, 0, (int)stream.Length);
                    // the file is availabe in the buffer
                }
            }
        }
    }


Regards,
Angel Petrov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
readyweb
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or