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

Unterminated string error

3 Answers 238 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jagdish
Top achievements
Rank 1
Jagdish asked on 22 Jul 2013, 05:31 PM
Hi,

I get the error "Kendo.Mvc.Infrastructure.Implementation.FilterParserException: Unterminated string" when I try to filter using the character "&"

Here is the URL of the query: 
localhost/Documents?Grid-sort=WorkOrder.ShortTitle-asc&Grid-page=1&Grid-pageSize=10&Grid-group=&Grid-filter=WorkOrder.ShortTitle~contains~'&'


[FilterParserException: Unterminated string]
Kendo.Mvc.Infrastructure.Implementation.FilterLexer.<TryParseString>m__17F(Char character) +164
Kendo.Mvc.Infrastructure.Implementation.FilterLexer.Read(Func`2 predicate, StringBuilder result) +57
Kendo.Mvc.Infrastructure.Implementation.FilterLexer.TryParseString(String& string) +180
Kendo.Mvc.Infrastructure.Implementation.FilterLexer.Tokenize() +155
Kendo.Mvc.Infrastructure.Implementation.FilterParser..ctor(String input) +39
Kendo.Mvc.Infrastructure.FilterDescriptorFactory.Create(String input) +54
Kendo.Mvc.UI.DataSourceRequestModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +202
Kendo.Mvc.UI.Grid`1.ProcessDataSource() +187
Kendo.Mvc.UI.Grid`1.WriteHtml(HtmlTextWriter writer) +574
Kendo.Mvc.UI.WidgetBase.ToHtmlString() +86
Kendo.Mvc.UI.Fluent.WidgetBuilderBase`2.ToHtmlString() +22
System.Web.HttpUtility.HtmlEncode(Object value) +38
System.Web.WebPages.WebPageBase.Write(Object value) +75

I am using kendo version 2013.1.514.340

Thanks

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 24 Jul 2013, 11:07 AM
Hi Jagdish,

I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jagdish
Top achievements
Rank 1
answered on 05 Aug 2013, 05:04 PM
Hi,

I used the code sample for Export Excel. I modified the web.config to use sql server.
 I can reproduce the error. Please see the screenshot attached and the project files.

Thanks
0
Atanas Korchev
Telerik team
answered on 07 Aug 2013, 09:00 AM
Hi,

 The & is a special character used to separate query string parameters. You need to encode the filter value like this:

href = href.replace(/filter=([^&]*)/, 'filter=' + (encodeURIComponent(requestObject.filter) || '~'));

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Jagdish
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Jagdish
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or