Unable to render columns

2 posts, 0 answers
  1. Man
    Man avatar
    48 posts
    Member since:
    Sep 2015

    Posted 15 Sep 2015 Link to this post

    I have a search form which will get a list of records.
    I would like to bind the search results on pressing submit after performing some initial ​checks on the entered data. How do i bind my action result to the Kendo Grid ?
     My JS File is 
    function validateDataForSearch() {
            var empNo = $("#empNo").val();
            var empName = $("#empName").val();
            var empMgr = $("#empMgr").val();
            var clientName = $("#ClientName").val();

            var noValues = empNo.length + empName.length + empMgr.length + clientName.length;

            if (noValues <= 0) {
                alert("Please enter at least one value to be able to search.");
            else {
                if (empNo.length <= 0)
                    empNo = 0;
                    type: "POST",
                    url: 'Home/Search',
                    data: { empNo: empNo, empName: empName, empMgr: empMgr, clientName: clientName },
                    success: function (response) {                


      function get​EmpLink(project) {
            var action = '@Url.Action("Index","PMP", new { ​emp= '+ ​emp +')';
            var ​empLink = kendo.format("<a href='{0}'>{2}</a>", action, ​emp.empNo);
            return empLink;

     var validator = $("#searchForm").kendoValidator().data("kendoValidator");

        $("#btnSearch").click(function (e) {        
            if (!validator.validate()) {




    My CSHTML is as follows

    @model IEnumerable<PMT.Models.EmpData> 
    <div id="kendoGrid">
        .Columns(columns =>
            columns.Bound(p => p.empNo).ClientTemplate("#= getEmpLink(data) #");
            columns.Bound(p => p.empName);
            columns.Bound(p => p.empMgr);
            columns.Bound(p => p.ClientName);

            columns.Bound(p => p.empSal).hidden(true);

        .Scrollable(scr => scr.Height(430))
        .DataSource(dataSource => dataSource


    I cant seem to render the grid to hide the empSal column or to show  the emloyeeid column as a hyperlink column

  2. Rosen
    Rosen avatar
    3253 posts

    Posted 17 Sep 2015 Link to this post

    Hello Man,

    I have looked at the code snippets you have pasted. It seems that there are few syntax errors, for example:

    '@Url.Action("Index","PMP", new { ​emp= '+ ​emp +')';
    //Note the missing } bracket at the end and the emp variable which is not defined.

    Also if I understood correctly this line is part of a JavaScript file, thus I suspect that the Razor code will not be executed at all. 

    Another thing I have noticed is the incorrect casing of the Column Hidden method, note the pascal casing. 

    The $.ajax success handler is referencing an incorrect element, as the Grid widget element ID seems to be SearchResult instead of pmtSearchResult.


    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top