This is a migrated thread and some comments may be shown as answers.

script for telerik mvc grid gets registered on page but is not firing

2 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
test
Top achievements
Rank 1
test asked on 05 Jul 2011, 01:24 PM
I have implemented telerik's mvc grid in my .net application. I am using features such as filtering, grouping etc. The problem is that the javascript/jquery required to execute these features is not working. I can see the script registered when i do view source for the page but the script doesnt fire. Where should i look to check if anything is missing? Could it be possible that the existing script files are preventing the script file for telerik from running? If yes, how can i verify this? Following is a snippet from the view source file which shows that script has been registered for the page.

<script type="text/javascript" src="/Scripts/2011.1.315/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.common.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.panelbar.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.textbox.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.grid.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.grid.filtering.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.draganddrop.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.grid.grouping.min.js"></script>
<script type="text/javascript" src="/Scripts/2011.1.315/telerik.grid.reordering.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function(){
jQuery('#PanelBar').tPanelBar({expandMode:1});
jQuery('#grdPersonView').tGrid({columns:[{"title":"Account Number","member":"AccountNumber","type":"Number"},{"title":"Cash Value","member":"CashValue","type":"Number"},{"title":"Full Company Name","member":"FullCompanyName","type":"String"}], plugins:["grouping","filtering","reordering"], urlFormat:'/Accounts/MarginRequirements/Margin/Index.aspx?grdPersonView-page=%7B0%7D&grdPersonView-orderBy=%7B1%7D&grdPersonView-groupBy=%7B2%7D&grdPersonView-filter=%7B3%7D&index=25', total:333, currentPage:1, pageSizesInDropDown:["5","10","20","50"], sortMode:'single', noRecordsTemplate:'No records to display.'});
jQuery('#Subgrid').tGrid({columns:[{"title":"Accounting Rule Code","member":"AccountingRuleCode","type":"String"},{"title":"Account Number","member":"AccountNumber","type":"Number"}], plugins:["filtering"],

2 Answers, 1 is accepted

Sort by
0
Nohinn
Top achievements
Rank 1
answered on 05 Jul 2011, 02:44 PM
Just looking at that code snippet it looks like you're calling the script files manually, I mean you should be using the ScriptRegistrar helper from telerik's mvc extensions.
Like this (for example):
<% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Add("telerik.grid.min.js")); %>

Leaving that aside, if you're using a partial view (I don't know as you did not mention it) take a look at:
http://www.telerik.com/help/aspnet-mvc/using-with-partial-views-loaded-via-ajax.html
0
test
Top achievements
Rank 1
answered on 06 Jul 2011, 07:51 AM
I have used @Html.Telerik().ScriptRegistrar(); in layout.cshtml to register the script files. I have not registered the script files for Telerik manually. The layout.cshtml is lying in a different project. I am using it in my project to render the views.I am not able to understand what is stopping the javascript functions from getting executed.

I am not using partial views at the moment
Tags
Grid
Asked by
test
Top achievements
Rank 1
Answers by
Nohinn
Top achievements
Rank 1
test
Top achievements
Rank 1
Share this question
or