This question is locked. New answers and comments are not allowed.
Hi, I have been following the troubleshooter here
trying to work out why my grid is not working. I am using version 2010.3.1110 of the MVC controls and a grid with AJAX binding. I am also trying to use both a server side template and a client side template to build action links in my grid. I have got things working in so far as the initial loading of my grid which loads with data correctly using my server side template.
If I then try to page forward or refresh the grid I get the correct count of records still appearing at the bottom of grid but no data is actually being displayed. Am I missing a data binding call or something?
Here is the code I am using for my grid.
I have followed the troubleshooter and tried removing the initial
This does not fix things. Any idea what I am doing wrong here?
trying to work out why my grid is not working. I am using version 2010.3.1110 of the MVC controls and a grid with AJAX binding. I am also trying to use both a server side template and a client side template to build action links in my grid. I have got things working in so far as the initial loading of my grid which loads with data correctly using my server side template.
If I then try to page forward or refresh the grid I get the correct count of records still appearing at the bottom of grid but no data is actually being displayed. Am I missing a data binding call or something?
Here is the code I am using for my grid.
<% Html.Telerik().Grid(Model)
.Name("UsersGrid")
.BindTo(Model)
.ToolBar(commands => commands.Custom().Text(ViewData["txtCreate"].ToString()).Action("SelectLicence", "Licence", new { height = 150, width = 350, modal = "true" }).HtmlAttributes(new { @class = "thickbox" }))
.ToolBar(commands => commands.Custom().Text("Create Batch").Action("CreateBatch", "ServiceUser", new { height = 400, width = 400, modal = "true" }).HtmlAttributes(new { @class = "thickbox", @style = "float:right" }))
.Columns(columns =>
{
columns.Bound(o => o.UserId)
.Template(o =>
{
%>
<%= Html.ActionLink("?????", "Edit", "ServiceUser_" + o.TreatmentId,
new { id = o.UserId, height = 600, width = 900, modal = "true" },
new { @class = "t-link action-edit thickbox" })
%>
<%
})
.Encoded(false)
.Width(25)
.Sortable(false)
.Filterable(false)
.HtmlAttributes(new { @style = "text-align:center" })
.ClientTemplate("<
a
href='" + Url.Action("Edit", "ServiceUser_<# TreatmentID #>") + "/<# UserId #>|||||</
a
>")
.Title(" ");
columns.Bound(o => o.UserId).Format(Html.ActionLink(ViewData["txtEdit"].ToString(), "Edit", "ServiceUser",
new { id = "{0}", height = 600, width = 900, modal = "true" },
new { @class = "t-link action-edit thickbox" }).ToString()).Title(" ").Encoded(false).Width(25)
.Sortable(false)
.Filterable(false)
.HtmlAttributes(new { @style = "text-align:center" });
columns.Bound(o => o.UserId).Format(Html.ActionLink(ViewData["txtView"].ToString(), "Details", "ServiceUser",
new { id = "{0}", height = 600, width = 900, modal = "true" },
new { @class = "t-link action-edit thickbox" }).ToString()).Title(" ").Encoded(false).Width(25)
.Sortable(false)
.Filterable(false)
.HtmlAttributes(new { @style = "text-align:center" });
columns.Bound(o => o.UserId).Format(Html.ActionLink(ViewData["txtPassword"].ToString(), "ResetPassword", "Account",
new { id = "{0}", height = 200, width = 500, modal = "true" },
new { @class = "t-link action-edit thickbox" }).ToString()).Title(" ").Encoded(false).Width(25)
.Sortable(false)
.Filterable(false)
.HtmlAttributes(new { @style = "text-align:center" });
columns.Bound(o => o.UserName).Title(ViewData["txtUsername"].ToString());
columns.Bound(o => o.UserFirstName).Title(ViewData["txtFirstname"].ToString());
columns.Bound(o => o.UserSurname).Title(ViewData["txtSurname"].ToString());
columns.Bound(o => o.UserEmail).Title(ViewData["txtEmail"].ToString());
columns.Bound(o => o.ActivationCode).Title(ViewData["txtActivationCode"].ToString());
columns.Bound(o => o.IsActive).Title(ViewData["txtActive"].ToString()).HtmlAttributes(new { @align = "center" });
})
.DataBinding(dataBinding => dataBinding.Ajax().Select("_AjaxBinding", "ServiceUser"))
.Filterable()
.Pageable(paging => paging.PageSize(13))
.Sortable()
.Render();
%>
I have followed the troubleshooter and tried removing the initial
FROM:
<%= Html.Telerik().Grid(Model) // Model is IEnumerable<
Order
>
%>
<%= Html.Telerik().Grid<
Order
>() // No longer passing a datasource
%>
TO:
<%= Html.Telerik().Grid<
Order
>()
.BindTo((IEnumerable<
Order
>)ViewData["Orders"])
%>
<%= Html.Telerik().Grid<
Order
>() // No longer calling the BindTo method
%>
This does not fix things. Any idea what I am doing wrong here?