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

AJAX binding doesn't work for me.

2 Answers 29 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.
CJ
Top achievements
Rank 1
CJ asked on 11 Mar 2012, 12:58 AM
I included all the scripts and created all the procedures. 

I included all the telerik scripts, and jQuery. but the ajax call never being sent to the server side.

@using Telerik.Web.Mvc.UI
@model IEnumerable<WorkOrder>
@{
    Layout = null;
  
    ViewBag.Title = "Orders";
     
}
<!DOCTYPE html >
<html>
<head>
    <script src="/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="/Scripts/telerik.all.js" type="text/javascript"></script>
  
  
@(Html.Telerik().StyleSheetRegistrar()
                      .DefaultGroup(group => group
                          .Add("telerik.common.css")
                              .Add("telerik.Office2010Blue.css")
                          .Add("telerik.rtl.css")
                          .Combined(true)
                          .Compress(true))
                     )
@*}*@
  
  
</head>
<body>
  
  
  
  
  
  
@(Html.Telerik().Grid<WorkOrder>()
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.WorkOrderId).Width(100);
        })
            .DataBinding(dataBinding => dataBinding.Ajax().Select("WorkOrdersList", "Grid"))
        .Pageable()
        .Sortable()
        .Scrollable()
        .Groupable()
        .Filterable()
)
  
  
</body>
</html>

2 Answers, 1 is accepted

Sort by
0
Reid
Top achievements
Rank 2
answered on 11 Mar 2012, 06:06 PM
Hi CJ,

A few points I would like to share.  I beleive the StyleSheetRegistrar by convention comes before the JS declarations.  Also, does the template have a Master?  I would make sure your MS Ajax scripts are being downloaded.  FireBug's "Net" tab shows all the assets that have been downloaded and those that have not as well as all JS errors.  VS also has the section in the Solution Explorer window at the top that becomes visible when your project is running.  That tree show the same list of JS that has downloaded.  Please make sure Ajax .JS is being downloaded.  The Intellisense tab also reveals a lot.

Reid
0
Dadv
Top achievements
Rank 1
answered on 12 Mar 2012, 10:40 AM
hi,

Layout =null => no masterpage

<script src="/Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>  => you want to use jquery by your own, so you need to tell telerik to do not use it (before the body end tag):

...
    @(Html.Telerik().ScriptRegistrar().jQuery(false).jQueryValidation(false))
</body>
</html>

You should add the unobstructive js too, for example  :

<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/mvc/3.0/MicrosoftMvcAjax.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.17/jquery-ui.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.unobtrusive-ajax.min.js"></script>

Try that and tell us the result

Regards,
Tags
Grid
Asked by
CJ
Top achievements
Rank 1
Answers by
Reid
Top achievements
Rank 2
Dadv
Top achievements
Rank 1
Share this question
or