Unexpected token # in JSON

2 posts, 0 answers
  1. Dan
    Dan avatar
    10 posts
    Member since:
    Jun 2015

    Posted 18 Jan 2017 Link to this post

    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?

  2. Dan
    Dan avatar
    10 posts
    Member since:
    Jun 2015

    Posted 18 Jan 2017 in reply to Dan Link to this post

    This was causing the issue `<a href='\\#'`  i simply removed the href and used the icon instead.
Back to Top