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

RadEditor ImageManager throwing a Parse Exception

12 Answers 171 Views
AJAX and Web 2.0
This is a migrated thread and some comments may be shown as answers.
Tono
Top achievements
Rank 1
Tono asked on 12 Nov 2013, 09:17 AM
Hi

We are using Telerik RadEditor in our web application, but some pretty features (like all the editors, ImageEditor, FlashEditor, ...) are not working. The only working editor is LinkEditor, so we had to disable the other editors.

We are using Telerik.Web.UI_2013_3_1015_Dev, Visual studio 2010.
The problem is, that when I try to create a simple web application with RadEditor, everything works fine, but when I use it in our complex company application, the editors don't work.
I've tried to add some lines into web.config, but it didn't help.

  <httpHandlers>
   <add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI"/>
   <add verb="*" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"></add>
   <add verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"></add>
   <add verb="*" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>
   <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false"/>
  </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" preCondition="managedHandler"/>
    </modules>
    <handlers>
      <add name="ChartImage.axd_*" path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode"/>
      <add name="Telerik.Web.UI.SpellCheckHandler.axd_*" path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode"/>
      <add name="Telerik.Web.UI.DialogHandler.aspx_*" path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode"/>
      <add name="Telerik.RadUploadProgressHandler.ashx_*" path="Telerik.RadUploadProgressHandler.ashx" verb="*" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI" preCondition="integratedMode"/>
      <add name="Telerik.Web.UI.WebResource.axd_*" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode"/>
    </handlers>
  </system.webServer>

//this is needed, otherwise I'm not able to run the application with radEditor
  <runtime>
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2013.3.1015.40" newVersion="2013.3.1015.40" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Code behind:
(called if !PostBack)

//hack solution - because of RadEditor bug in IE9 with br tags
        RadEditor1.DisableFilter(EditorFilters.ConvertToXhtml)

        RadEditor1.Content = string.Empty;
       
        RadEditor1.EditModes = EditModes.Design | EditModes.Preview;
       
        RadEditor1.LocalizationPath = "~/App_GlobalResources/RadEditor/en";
        RadEditor1.ToolsFile = "~/App_GlobalResources/RadEditor/Tools/FullSetTools.xml";



Markup:
<telerik:RadEditor runat="server" ID="RadEditor1"
 Language="en-US" EnableResize="false" SkinID="DefaultSetOfTools" Height="300px" Width="98%">
</telerik:RadEditor>

I can't send you more of the code because of our company rules.
Can you please help with some hacks or settings in web.config ?

Thank you
T

When I try to open ImageEditor, I get this Exception:

Server

 

Error in '/' Application.

--------------------------------------------------------------------------------

Expression expected

Description:

 

An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception

Details: Telerik.Web.UI.ParseException: Expression expected

Source

 

Error:

An unhandled exception was generated during the execution

of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack

Trace:

[ParseException: Expression expected]

Telerik

.Web.UI.ExpressionParser.ParsePrimaryStart() +245

Telerik

.Web.UI.ExpressionParser.ParsePrimary() +47

Telerik

.Web.UI.ExpressionParser.ParseUnary() +406

Telerik

.Web.UI.ExpressionParser.ParseMultiplicative() +54

Telerik

.Web.UI.ExpressionParser.ParseAdditive() +54

Telerik

.Web.UI.ExpressionParser.ParseComparison() +69

Telerik

.Web.UI.ExpressionParser.ParseLogicalAnd() +49

Telerik

.Web.UI.ExpressionParser.ParseLogicalOr() +49

Telerik

.Web.UI.ExpressionParser.ParseExpression() +74

Telerik

.Web.UI.ExpressionParser.Parse(Type resultType) +76

Telerik

.Web.UI.DynamicExpression.ParseLambda(ParameterExpression[] parameters, Type resultType, String expression, Object[] values) +92

Telerik

.Web.UI.DynamicExpression.ParseLambda(Type itType, Type resultType, String expression, Object[] values) +132

Telerik

.Web.UI.GridDynamicQueryable.Where(IQueryable source, String predicate, Object[] values) +235

Telerik

.Web.UI.GridDataTableFromEnumerable.FillData35() +3952

Telerik

.Web.UI.GridDataTableFromEnumerable.FillData() +1078

Telerik

.Web.UI.GridResolveEnumerable.Initialize() +58

Telerik

.Web.UI.GridResolveEnumerable.EnsureInitialized() +45

Telerik

.Web.UI.GridResolveEnumerable.get_DataTable() +36

Telerik

.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, DataView dataView, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +245

Telerik

.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +109

Telerik

.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +188

Telerik

.Web.UI.GridTableView.get_ResolvedDataSource() +256

Telerik

.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +340

System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +117

System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +205

System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +131

System.Web.UI.WebControls.DataBoundControl.PerformSelect() +233

Telerik

.Web.UI.GridTableView.PerformSelect() +38

System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +140

Telerik

.Web.UI.GridTableView.DataBind() +389

Telerik

.Web.UI.RadGrid.DataBind() +191

Telerik

.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +4246

Telerik

.Web.UI.RadGrid.Rebind() +71

Telerik

.Web.UI.FileExplorer.FileList.UpdateLocalization() +631

Telerik

.Web.UI.FileExplorer.FileList.ControlsPreRender() +244

Telerik

.Web.UI.RadFileExplorer.ControlPreRender() +549

Telerik

.Web.UI.RadWebControl.OnPreRender(EventArgs e) +47

System.Web.UI.Control.PreRenderRecursiveInternal() +239

System.Web.UI.Control.PreRenderRecursiveInternal() +337

System.Web.UI.Control.PreRenderRecursiveInternal() +337

System.Web.UI.Control.PreRenderRecursiveInternal() +337

System.Web.UI.Control.PreRenderRecursiveInternal() +337

System.Web.UI.Control.PreRenderRecursiveInternal() +337

System.Web.UI.Control.PreRenderRecursiveInternal() +337

System.Web.UI.Control.PreRenderRecursiveInternal() +337

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5044


12 Answers, 1 is accepted

Sort by
0
Tono
Top achievements
Rank 1
answered on 12 Nov 2013, 09:20 AM
I forgot to mention, that setting the ViewPaths of the ImageManager didn't help, but I don't think, that setting the ViewPaths property is mandatory.

var viewImages = new [] { "~/Images" };
RadEditor1.ImageManager.ViewPaths = viewImages;

We are using IE9.
0
Ianko
Telerik team
answered on 14 Nov 2013, 12:41 PM
Hi Tono,

I am unable to reproduce the problem on my end, it would be helpful if you could be able to get back to me with more details about the scenario in which the dialogs appears broken. For example in the exception provided I can see that a Grid control is used, although I can only make assumptions on the specific scenario.

Note that it would be very useful if you are able to provide a simple project, which isolates the problem, so that I could run and investigate it locally. 

Regards,
Ianko
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
Tono
Top achievements
Rank 1
answered on 19 Nov 2013, 07:43 AM
Hi

I can't create a simple project which contains the error I've mentioned above, because I can't find the part in our application, that is causing the problem. I have simple project with RadEditor, but it works very well, so there's no reason to send it to you. But...
We've figured out, what was the first problem (yes, there is more): It was our Resource provider. We are using our own resource provider and everytime, when key contained "ReservedResource", the resource provider returned our default NotLocalizedText. That caused, that when Telerik Expression.ParserPrimaryStart method tried to test this condition "switch (this.token.id)", it ended in "default:" part of the switch, because token.id was "Question". We updated our Resource provider and now the managers don't throw an exception but show a dialog window. But...
ImageManager: When I try to insert selected image, our application stoppes on javascript with this error: "Microsoft JScript runtime error: Object doesn't support property or method 'cloneNode'"
The javascript part is: getOuterHtml:function(b){if(b.outerHTML){return b.outerHTML;}else{var a=b.cloneNode(true); (b is HTMLImageElement)
The other thing is, that when I try to add picture into Image Map editor using Image Manager, it does nothing. Althoug I click the Insert button in Image manager, but nothing is added into Image Map editor.

It works in my simple test application, so it is probably another problem specific for our application, but the javascript is from Telerik, so maybe you have a clue, what can be behind this errors.

Thank you
TP
0
Tono
Top achievements
Rank 1
answered on 19 Nov 2013, 09:19 AM
We got it, I hope !
It was in the version of Telerik.Web.UI.dll.
We used version 2013.01.417, but version 2013.3.1015.40 did the job.

Adding images using ImageManager now works and adding them into Image Map editor using the ImageManager works too.
0
Sudam
Top achievements
Rank 1
answered on 26 Mar 2020, 12:31 PM

I am facing same issue.

We are upgrading the Teleric version from 2008 to 2019. No compile time error but getting ": Telerik.Web.UI.ParseException: Expression expected" on dialog pop up.

 

Here is stack trace

[ParseException: Expression expected] Telerik.Web.UI.ExpressionParser.ParsePrimaryStart() +124 Telerik.Web.UI.ExpressionParser.ParsePrimary() +14 Telerik.Web.UI.ExpressionParser.ParseUnary() +262 Telerik.Web.UI.ExpressionParser.ParseMultiplicative() +26 Telerik.Web.UI.ExpressionParser.ParseAdditive() +25 Telerik.Web.UI.ExpressionParser.ParseComparison() +26 Telerik.Web.UI.ExpressionParser.ParseLogicalAnd() +26 Telerik.Web.UI.ExpressionParser.ParseLogicalOr() +26 Telerik.Web.UI.ExpressionParser.ParseExpression() +23 Telerik.Web.UI.ExpressionParser.Parse(Type resultType) +24 Telerik.Web.UI.DynamicExpression.ParseLambda(ParameterExpression[] parameters, Type resultType, String expression, Object[] values) +47 Telerik.Web.UI.DynamicExpression.ParseLambda(Type itType, Type resultType, String expression, Object[] values) +65 Telerik.Web.UI.GridDynamicQueryable.Where(IQueryable source, String predicate, Object[] values) +62 Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +2319 Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +678 Telerik.Web.UI.GridResolveEnumerable.Initialize() +35 Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +24 Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, DataView dataView, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +206 Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +71 Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText) +202 Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +169 Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +368 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +67 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +133 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +34 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +151 Telerik.Web.UI.GridTableView.PerformSelect() +16 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +76 Telerik.Web.UI.GridTableView.DataBind() +283 Telerik.Web.UI.RadGrid.DataBind() +87 Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +2389 Telerik.Web.UI.RadGrid.Rebind() +101 Telerik.Web.UI.FileExplorer.FileList.UpdateLocalization() +453 Telerik.Web.UI.FileExplorer.FileList.ControlsPreRender() +143 Telerik.Web.UI.RadFileExplorer.ControlPreRender() +1173 Telerik.Web.UI.RadWebControl.OnPreRender(EventArgs e) +22 System.Web.UI.Control.PreRenderRecursiveInternal() +90 System.Web.UI.Control.PreRenderRecursiveInternal() +163 System.Web.UI.Control.PreRenderRecursiveInternal() +163 System.Web.UI.Control.PreRenderRecursiveInternal() +163 System.Web.UI.Control.PreRenderRecursiveInternal() +163 System.Web.UI.Control.PreRenderRecursiveInternal() +163 System.Web.UI.Control.PreRenderRecursiveInternal() +163 System.Web.UI.Control.PreRenderRecursiveInternal() +163 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +906

0
Rumen
Telerik team
answered on 26 Mar 2020, 02:59 PM

Hi Sudam,

Could you please try to set the EnableLinqExpressions of the RadGrid component to false to see if the problem still exists? In order to achieve this you need to modify the built-in FileBrowser.ascx dialog.
An example of how to modify built-in dialogs is available in this live demo, and this KB article demonstrates how to access RadFileExplorer control.

If this does not solve the issue could you please provide a sample fully runnable project reproducing the problem so we can examine and debug it locally?

Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Sudam
Top achievements
Rank 1
answered on 27 Mar 2020, 10:38 AM

Hi Rumen, thanks for reply.

There is no reference for grid in FileBrowser.aspx. Please find below code from it.

<%@ Control Language="C#" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI.Widgets" TagPrefix="widgets" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI.Dialogs" TagPrefix="dialogs" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<script type="text/javascript">
Type.registerNamespace("Telerik.Web.UI.Editor.DialogControls");

Telerik.Web.UI.Editor.DialogControls.FileBrowser = function(element)
{
Telerik.Web.UI.Editor.DialogControls.FileBrowser.initializeBase(this, [element]);
}

Telerik.Web.UI.Editor.DialogControls.FileBrowser.prototype = {
initialize: function()
{
this.set_insertButton($get("InsertButton"));
this.set_cancelButton($get("CancelButton"));

var previewer = this.get_previewerType();
var previewerType = eval("Telerik.Web.UI.Widgets." + previewer);
$create(previewerType, { "browser": this }, null, null, $get(previewer));
this.set_filePreviewer($find(previewer));
this.set_fileBrowser($find("RadFileExplorer1"));

Telerik.Web.UI.Editor.DialogControls.FileBrowser.callBaseMethod(this, 'initialize');
},

dispose: function()
{
Telerik.Web.UI.Editor.DialogControls.FileBrowser.callBaseMethod(this, 'dispose');
this._insertButton = null;
this._cancelButton = null;
}
}

Telerik.Web.UI.Editor.DialogControls.FileBrowser.registerClass('Telerik.Web.UI.Editor.DialogControls.FileBrowser', Telerik.Web.UI.Widgets.FileManager);
</script>
<div class="redWrapper redWrapperClean">
<div class="redFBWrapper">
<div class="redFEWrapper">
<telerik:RadFileExplorer ID="RadFileExplorer1" Height="400px" Width="400px" TreePaneWidth="150px" runat="Server" EnableOpenFile="false" AllowPaging="true" PageSize="100" />
</div>
<div class="redDialogSeparator"></div>
<div class="redFBDialogContent">
<div class="redFBDialogContentContainer">
<asp:PlaceHolder ID="PreviewerPlaceHolder" runat="server" />
</div>
<div class="redFBDialogContentButton redActionButtonsAbsoluteWrapper">
<button type="button" id="InsertButton" class="rfdPrimaryButton rfdFlatButton">
<script type="text/javascript">setInnerHtml("InsertButton", localization["Insert"]);</script>
</button>
<button type="button" id="CancelButton" class="rfdFlatButton">
<script type="text/javascript">setInnerHtml("CancelButton", localization["Cancel"]);</script>
</button>
</div>
</div>
</div>
</div>

0
Rumen
Telerik team
answered on 27 Mar 2020, 11:01 AM

Hi Sudam,

You can use the solution from this KB article to get reference to the Grid control:

    protected void Page_Load(object sender, System.EventArgs args)  
    {  
        Telerik.Web.UI.RadFileExplorer rfe = (Telerik.Web.UI.RadFileExplorer)this.FindRadControl(this.Page);  
        if (rfe != null)  
        { 
            rfe.Grid.EnableLinqExpressions = false;
        }  
    }

Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Sudam
Top achievements
Rank 1
answered on 27 Mar 2020, 12:34 PM

Hi Rumen, Thanks for quick reply.

My project had Telerik 2008 version. I am updating to 2019 version. We already have EditorFolder and customized ImageManager.ascx. But I didn't find any FileBrowser.ascx under that. Then I copied it  from installation folder to project folder added to project solution and added the code from blog to set EnableLinqExpressions to false. But still same issue. 

0
Rumen
Telerik team
answered on 27 Mar 2020, 01:18 PM

Hi Sudam,

Thank you for the extra details!

In this case, you will need to obtain all the external dialogs files from the same installation from which you have obtained the Telerik.Web.UI.dll. You can also register them from the Smart tag:

Once you do that you will need to customize the ImageManager.ascx from scratch since there isn't backwards compatibility between the 2008 and 2020 versions.

 

Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Sudam
Top achievements
Rank 1
answered on 31 Mar 2020, 01:01 PM

Hi Rumen, Still facing the issue. Here are the steps I performed.

 1. Deleted EditDilogs folder from project

2.  Added latest folder from installation folder to project

3. Added new user control and code to set EnableLinqExpressions false

4. Added Control to FileBrowser.aspx

When I tried to debug, it's not hitting Page_Load method of UserControl.ascx

Please help me its been one week  now I am stuck due to this issue

0
Rumen
Telerik team
answered on 31 Mar 2020, 03:03 PM

Hi Sudan,

For your convenience, I prepared a sample app and recorded my test in the attached video. You can see that you can get a reference to the Grid.

 I hope that it will help you to see the differences with your project and find out why the breakpoint does not hit in your app.

 

Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
AJAX and Web 2.0
Asked by
Tono
Top achievements
Rank 1
Answers by
Tono
Top achievements
Rank 1
Ianko
Telerik team
Sudam
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or