views:

360

answers:

1

Hello Freinds I am new to this Asp.net MVC Control.. I have a page which I implemented previously using Jquery I am dispalying the data in grid control. now I need to change that Jquery grid to Telerik grid.. I included Script in aspx page as weel as I aded telrik dll in my References..

I added all the telrik specification to the site master page and solutinos explorer..

I followed the demo in telrik site.. but I am not getting the out put result to my page.. that I can not see the grid result.. The code followed like this

I added all the telrik specification to the site master page and solutinos explorer..

and in view I wrote like this

<%Html.Telerik().Grid<TableName>()
 .Name("Grid")
    .Columns(columns =>
    {
        columns.Add(o => o.A).Width(100);
        columns.Add(o => o.B).Width(200);
        columns.Add(o => o.C);
        columns.Add(o => o.D).Width(120);
        columns.Add(o => o.E).Width(100);
    })
    .Ajax(ajax => ajax.Action("_AjaxBinding", "Grid"))
    .Pageable()
    .Sortable()
    .Scrollable();
%>

and in Controller I wrote

public ActionResult AjaxBinding()
    {
        return View();
    }
    [GridAction]
    public ActionResult _AjaxBinding()
    {
        return View(new GridModel<tableName>
        {
            Data = repository.GetAllinfo()
        });
    }

when I ran I am not getting any exceptions but I am not able to see the result in grid on the page..

this GetAllInfo code is

public IEnumerable<tableName> GetAllinfo()
    {
        //Try to retrieve clients from the cache
        var index = cache.Get<IEnumerable<tablename>>("A");

        //Check for empty cache
        if (null == index)
        {
            index = tablename.All();
            cache.Store("c", A);

        }
        return A;

    }

is there anything I need to do extra to get result in the grid view?

Thanks

+2  A: 

Change this:

<% Html.Telerik().Grid<TableName>()

to this

<%= Html.Telerik().Grid<TableName>()

The grid will not emit its HTML unless <%= %> is used or the Render() method is called.

korchev