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

Error - Multiple image upload in single record through grid and binary image example

5 Answers 85 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Aamir Ali Ansari
Top achievements
Rank 2
Aamir Ali Ansari asked on 11 May 2011, 07:37 AM
I am using your sample code to upload image to the database.
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx

The example works fine when i am using only one image upload feature. Since my table has three image columns for different reasons, I am unable to modify the code for inclusion of multiple uploads for each column. Can u share any sample code as i am getting an error "System.InvalidCastException: Object must implement IConvertible.". I am unable to fix it. I am trying below mentioned code.

   function conditionalPostback(sender, eventArgs) {
                    var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
                    if (eventArgs.get_eventTarget().match(theRegexp)) {
                        var upload = $find(window['UploadId']);
                        var uploadmid = $find(window['UploadIdMid']);
                        var uploadthumb = $find(window['UploadIdThumb']);
  
//                         Test script for all
                        if (upload.getFileInputs()[0].value != "" || uploadmid.getFileInputs()[0].value != "" || uploadthumb.getFileInputs()[0].value != "") {
                            eventArgs.set_enableAjax(false);
                        }
     }
}

5 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 16 May 2011, 08:41 AM
Hi Aamir,

I am sending you a simple example which demonstrates the desired functionality. Please check it out and let me know if it helps you.

Best wishes,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Arun Kumar
Top achievements
Rank 1
answered on 19 Aug 2011, 02:02 PM
Hi,
I have RadGrid with one GridBinaryImageColumn, When the user clicks Select button, couldn't able to select multiple Images.

Can you please tell me a way of choosing/selecting multiple imagesby using only one GridBinaryImageColumn.


Appreciate your help and support.

Thanks,
Arun
0
Radoslav
Telerik team
answered on 24 Aug 2011, 07:47 AM
Hi Arun,

The RadGrid does not support uploading multiple images in one GridBinaryImageColumn when the grid is bound via DataSource control and the automatic operations are used.
 
In order to achieve the desired functionality you could try using the GridTemaplateColumn with RadBinaryImage control into its ItemTemplate and RadUpload into its EditItemTemplate.
However in this case you need to handle all CRUD operations manually.  On the following link you could find online example which demonstrates Grid Manual Operations:
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandradasyncupload/defaultcs.aspx?product=grid

I hope this helps.

Greetings,
Radoslav
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Velissarios
Top achievements
Rank 1
answered on 25 Aug 2011, 02:08 PM
Hello to all

In this example you gave, it is mandatory to add the 3 images in order to continue.

Is it possible to explain to me, how I can achive to enter - for example- the first binary image into the database, leave the other images without any image file and if someone needs later, can insert the other images, leaving the first one intact?

Yours
Velissarios
vhousos@gmail.com

0
Radoslav
Telerik team
answered on 30 Aug 2011, 07:44 AM
Hi Velissarios,

To achieve the desired functionality you need to have three binary columns into your database. In edit mode you could show a RadUpload with three inputs. Then into the code behind you could get the uploaded images and update the corresponding database columns.
To distinguish files uploaded from the different inputs you could try using the approach described in the following online documentation article:
Adding Information to Uploaded Files

I hope this helps.

Kind regards,
Radoslav
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
BinaryImage
Asked by
Aamir Ali Ansari
Top achievements
Rank 2
Answers by
Radoslav
Telerik team
Arun Kumar
Top achievements
Rank 1
Velissarios
Top achievements
Rank 1
Share this question
or