How do I save the image after I have made changes using asp:button OnClick="xxx" (post back) to the database?
I have several controls (asp:Panel, asp:Label....) that I need to update after I change the image....
I'm reading my picture using OnImageLoading
Protected Sub RadImageEditor1_ImageLoading(sender As Object, args As ImageEditorLoadingEventArgs)
Dim MyConnection As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("MyConn").ConnectionString)
Dim MyCommand As New SqlCommand("select ID, imagedata from bildbank_data where ID = @ID;", MyConnection)
MyCommand.Parameters.Add(New SqlParameter("@ID", SqlDbType.Int, 4))
MyCommand.Parameters("@ID").Value = lblPickUpId.Text
If MyConnection.State = ConnectionState.Closed Then
MyConnection.Open()
End If
Dim dr1 As SqlDataReader = MyCommand.ExecuteReader
If dr1.Read Then
If Not dr1("imagedata") Is DBNull.Value Then
Dim imagedata As Byte() = dr1("imagedata")
Dim s As New MemoryStream(imagedata.ToArray())
Dim img As New Telerik.Web.UI.ImageEditor.EditableImage(s)
args.Image = img
args.Cancel = True
End If
End If
dr1.Close()
MyCommand.Dispose()
MyConnection.Close()
End Sub
In the ImageEditor control there are a couple of options for loading and saving images to and from custom locations. The simple and easy way is to handle the ImageLoading and ImageSaving events. Please, check the following help article that is related to the server-side events - https://docs.telerik.com/devtools/aspnet-ajax/controls/imageeditor/server-side-programming/events.
If you need more control and better handling of the loading and saving process, then you can use the option to provide a custom content provider -Use Custom FileBrowserContentProvider. There is a demo dedicated to that functionality - Using Custom Content Provider.
You can also review my post about saving images via an external button in the following forum reply - https://www.telerik.com/forums/radimageeditor-1559746#5469566.