Hi, I use the RadDataform to manage some company news within my application. (NewsData object - )
I was able to manage the addition of a RadAsyncUpload in the ItemInsertTemplate mixed with a RadBinaryImage.
When the user upload an image, a preview of the image is shown by the BinaryImage (using this example http://demos.telerik.com/aspnet-ajax/imageeditor/examples/imageupload/defaultcs.aspx?product=asyncupload)
Using the RadDataForm, I went with the manual CRUD approch. I read your article about the manual CRUD using the _ItemInserting method.
So my code is
This is my code when the ImageUploadEvent is raised on the server side when the user upload an image.
My problem is: the Image key in my hashtable is null. But all the other properties are filled correctly according to my Business object.
I even tried to browse RadDataForm1.FindControl("RadBinaryImage1") and the binaryimage is set to an URL.
Is there a way to get the binary data of the image so i can save it in my database manually.
I was able to manage the addition of a RadAsyncUpload in the ItemInsertTemplate mixed with a RadBinaryImage.
When the user upload an image, a preview of the image is shown by the BinaryImage (using this example http://demos.telerik.com/aspnet-ajax/imageeditor/examples/imageupload/defaultcs.aspx?product=asyncupload)
Using the RadDataForm, I went with the manual CRUD approch. I read your article about the manual CRUD using the _ItemInserting method.
So my code is
protected void RadDataForm1_ItemInserting(object sender, RadDataFormCommandEventArgs e) { RadDataFormInsertItem insertedItem = e.DataFormItem as RadDataFormInsertItem; Hashtable newValues = new Hashtable(); insertedItem.ExtractValues(newValues); RPKNewsData test = new RPKNewsData(newValues); test.Save(); }This is my code when the ImageUploadEvent is raised on the server side when the user upload an image.
protected void Test2_FileUploaded(object sender, FileUploadedEventArgs e) { RadDataFormEditableItem editItem = ((Telerik.Web.UI.RadWebControl)(sender)).NamingContainer as RadDataFormEditableItem; RadBinaryImage bImg = editItem.FindControl("RadBinaryImage1") as RadBinaryImage; byte[] image; long fileLength = e.File.InputStream.Length; image = new byte[fileLength]; e.File.InputStream.Read(image, 0, image.Length); bImg.DataValue = image; }My problem is: the Image key in my hashtable is null. But all the other properties are filled correctly according to my Business object.
I even tried to browse RadDataForm1.FindControl("RadBinaryImage1") and the binaryimage is set to an URL.
Is there a way to get the binary data of the image so i can save it in my database manually.