Question

I started using the Telerik Html.Grid today and have already run into a problem. The Grid itself is appearing, but text based so i know this is a style sheet issue. Also, i have been following the usage instructions with the documentation. Ill go through them and explain what i did, maybe my interpretation was wrong.

1)Open an existing ASP.NET MVC application in Visual Studio or create a new one. Done

2)Add a reference to Telerik.Web.Mvc.dll which is located in the Binaries folder of Telerik Extensions for ASP.NET MVC install location: Done

3)Register the Telerik Extensions for ASP.NET MVC namespaces: Done, but i used import instead of add

<%@ Import Namespace="Telerik.Web.Mvc.UI" %>

4)Add the JavaScript files in the Scripts folder of your ASP.NET MVC application. Done, but essentailly the scripts are in the location Web/Scripts/2010.2.825 I also put in the ScriptRegistrar at the end of my .aspx page

<div id="footer">
        <% Html.RenderPartial("SiteMasterFooter");%>
    </div>

    <div style="clear: both;"><!-- --></div>

    <%
           Html.Telerik().ScriptRegistrar().jQuery(false); 
    %>

5)Add the CSS files in the Content folder of your ASP.NET MVC application. Done. Same approach as step 4, the location is Wed/Content/2010.2.825 I also put the Style sheet registrar at the head of the aspx page

<%
        Html.Telerik().StyleSheetRegistrar()
                        .DefaultGroup(group => group.Add("telerik.common.css")
                                                    .Add("telerik.windows7.css")); 
    %>

6)Create a telerik web control Done. Dont think i can screw this up, but hey.

<%
                    Html.Telerik().Grid(Model.Manifests)
                        .Name("ManifestsGrid")
                        .DataKeys(keys =>
                                        {
                                            keys.Add(p => p.Id);
                                        })
                        .Columns(columns =>
                                    {
                                        columns.Bound(o => o.ManifestId).Width(150).Title(
                                            "Manifest #:");
                                        columns.Bound(o => o.Generator.CompanyName).Width(150).Title
                                            ("Company:");
                                        columns.Bound(o => o.GeneratorFieldOffice.FacilityName).
                                            Width(150).Title("Field Office:");
                                        columns.Bound(o => o.GeneratorFacility.FacilityName).Width(
                                            150).Title("Facility:");
                                    })
                        .Pageable(paging => paging.PageSize(10))
                        .Selectable()
                        .Scrollable()
                        .Render(); 

                %>

So i think that my problem lies with how ive added the files i need. Any input?

Was it helpful?

Solution

I fixed it actually. For anyone reading this, the problem was that i follow the guide to the letter. And take very special care as to what <% %> tags have : or = at the beginning or a ; at the end. If this is too vague post an answer to this question and ill post my code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top