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

Unexpected token # in JSON

1 Answer 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 18 Jan 2017, 02:52 PM

I am trying to load the grid state from the json that is saved when saving grid state.  I am using `JSON.parse(text)` text being my json.  The actual code works everywhere else but the unexpected token # in json is causing issues.

 

This is the specific area that is causing the issue

columns.Template(@<text>
 
            </text>)
                      .Title("Actions")
                      .ClientTemplate(
                          "<a href='" + @Url.Action("EditTime", "TimePunches", new { id = "#=ID#", flt = @ViewBag.FLT }) + "' title='Edit'><i class='icon-edit fa fa-pencil fa-fw fa-lg'></i></a>" +
                        "<a href='" + @Url.Action("PunchLogIndex", "TimePunches", new {id = "#=ID#", flt = @ViewBag.FLT}) +"' title='Punch Log'><i class='icon-purple fa fa-book fa-fw fa-lg'></i></a>" +
                        "<a href='" + @Url.Action("PunchRequestIndex", "TimePunches", new { punchId = "#=ID#", flt = ViewBag.FLT }) + "' title='See Change Request Log'><i class='icon-niagara fa fa-list fa-fw fa-lg'></i></a>" +
                        "<a href='\\#' id='delete' data-id='#=ID#' data-client='#=ClientID#'><i class='icon-red fa fa-times fa-fw fa-lg'></i></a>").Width(150).HeaderHtmlAttributes(new { @class = "header-center" });

 

It's my understanding that the razor text attributes are not liked when loading grid state. Is there a way to load this template in after the fact?

1 Answer, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
answered on 18 Jan 2017, 03:04 PM
This was causing the issue `<a href='\\#'`  i simply removed the href and used the icon instead.
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Share this question
or