Save image in RadImageEditor

0 Answers 30 Views
Top achievements
Rank 1
Kjell asked on 08 Mar 2023, 09:41 AM

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
        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



    End Sub

Telerik team
commented on 10 Mar 2023, 04:17 PM

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 -

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 -

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question