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

Editor in grid image manager paths

3 Answers 44 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Sauge
Top achievements
Rank 1
Sauge asked on 09 Dec 2013, 10:19 PM
Hi there

I am trying to set the image manager paths, in an editor, in a template column of a radgrid from code behind like this:

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)
        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then
            Dim editor1 As RadEditor = e.Item.FindControl("Radeditor1")
            Dim UserId As String

            UserId = Membership.GetUser().ProviderUserKey.ToString()

            editor1.ImageManager.ViewPaths = New String() {"~/images/users/" + UserId + "/uploads"}
            editor1.ImageManager.DeletePaths = New String() {"~/images/users/" + UserId + "/uploads"}
            editor1.ImageManager.UploadPaths = New String() {"~/images/users/" + UserId + "/uploads"}
            editor1.ImageManager.EnableAsyncUpload = True
            editor1.ImageManager.SearchPatterns = New String() {"*.jpeg", "*.jpg", "*.bmp", "*.gif", "*.png"}
        End If

    End Sub


Please could someone tell me what am I doing wrong here

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 12 Dec 2013, 12:45 PM
Hi Sauge,

The latest moment of the page life cycle in which you can configure ImageManager's paths is the Page_Load event. Doing it in a later event it may bring many unexpected errors, causing the control not to function properly.

Could you move the configuration from the provided code snippet to the Page_Load event and see whether the problem still occurs?

Regards,
Veselina Raykova
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.
0
Sauge
Top achievements
Rank 1
answered on 13 Dec 2013, 07:08 AM
Hi Veselina

Thank you for your response, but I am having trouble referencing the image manager from page load as the image manager is in an editor contained in a template column of a radgrid

Have you any idea how I can do this

Thank you in advance :-)
0
Angel Petrov
Telerik team
answered on 17 Dec 2013, 04:05 PM
Hi Sauge,

You can access the image manager by obtaining a reference to the cell of the edit item and then using FindControl to locate the control.
editableItem["ColumnUniqueName"].FindControl("ImageManager")
More information on accessing cells and rows is available in this help article.

Additionally note that the PageLoad event is fired too early and the edit item may not be created. That said it would be best to show us the markup and relevant code-behind so we could provide a more precise answer.

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
Editor
Asked by
Sauge
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Sauge
Top achievements
Rank 1
Angel Petrov
Telerik team
Share this question
or