html decode issue with strings in a grid cell

4 posts, 0 answers
  1. Todd
    Todd avatar
    1 posts
    Member since:
    Mar 2015

    Posted 03 Apr 2015 Link to this post

    I am using html.Encode when saving the data in the db.  So in the db I have &lt;&gt; but when I show the data in the grid to the users I want them to see <>.  How can I accomplish decoding the string?

     

    function loadActivity2Grid() {

    intCompanyValue = $('#hdnCompanyID').val();

    if (intCompanyValue != "0" && blnActivityLoaded == false) {

    var ds = new kendo.data.DataSource({
    transport: {
    read: {
    url: "WebService.asmx/loadActivity",
    dataType: "json",
    contentType: "application/json; charset=utf-8",
    type: "GET",
    data: { intCompanyID: intCompanyValue }
    }
    },
    pageSize: 10,
    schema: {
    //data: function (data) {
    // return data.d;
    //},
    data: "d",
    total: "d.length",
    model: {
    fields: {
    intNoteID: { type: "number" },
    ActType: { type: "string" },
    Employee_Name: { type: "string" },
    appt_date: { type: "date" },
    activity_completed_date: { type: "date" },
    OutcomeNotes: { type: "string" },
    ContactName: { type: "string" }
    }
    }
    }
    , sort: ({ field: "appt_date", dir: "desc" })
    });

    $("#grdActivity2").kendoGrid({
    dataSource: ds,
    width: 870,
    filterable: true,
    sortable: {
    mode: "multiple"
    },
    pageable: {
    refresh: true,
    pageSizes: true,
    previousNext: true
    },
    scrollable: false,
    columns: [
    {
    template: '<input type="button" class="btn_small" value="View" onclick="viewActivity(\'#=intNoteID#\');" />', width: 50,
    width: 50
    },

    {
    field: "ActType",
    title: "Type",
    width: 75
    },
    {
    field: "Employee_Name",
    title: "Assigned To",
    width: 125
    },
    {
    field: "appt_date",
    title: "Scheduled<br>Date",
    format: "{0:MM/dd/yyyy}",
    width: 75
    },
    {
    field: "activity_completed_date",
    title: "Date<br>Completed",
    format: "{0:MM/dd/yyyy}",
    width: 75
    },
    {
    field: "OutcomeNotes",
    title: "Outcome/Notes",
    width: 345
    },
    {
    field: "ContactName",
    title: "Contact",
    width: 125
    }
    ]
    });

    }

    }

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 07 Apr 2015 Link to this post

    Hello Todd,

    You can use the encoded property of the column and set it to true, so the HTML string is displayed as is. Here is an example:

    http://dojo.telerik.com/IfIti

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Diptesh
    Diptesh avatar
    1 posts
    Member since:
    Jun 2011

    Posted 02 Aug in reply to Kiril Nikolov Link to this post

    Hi,

    How do we handle this for dynamically bound grids? where columns are generated dynamically.

     

  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 03 Aug Link to this post

    Hi,

    Please open a separate support request with the code of your generated columns and we will be happy to take a look and provide with a possible solution.

    Thanks for the understanding.

    Regards,
    Kiril Nikolov
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
Back to Top
Kendo UI is VS 2017 Ready