This question is locked. New answers and comments are not allowed.
I have a problem in using the MVC grid for days.
After enabling Ajax Binding, when i click page 2, it renders the page correctly,
but after that, if i click page 1 to return back, in the corner it rights
Displaying items 1 - 10 of 14
but the records part does not change.
Very strange...
I will be appreciated if i can solve this issue...
note:
When i look at JSON result , it shows 10 records, but does not render them...
Also i noticed that, when page 2 clicked it displays the first 4 records, only the others dissappear,
as it was supposed to display the last 4 records. It is also unexpected...
After enabling Ajax Binding, when i click page 2, it renders the page correctly,
but after that, if i click page 1 to return back, in the corner it rights
Displaying items 1 - 10 of 14
but the records part does not change.
Very strange...
I will be appreciated if i can solve this issue...
note:
When i look at JSON result , it shows 10 records, but does not render them...
Also i noticed that, when page 2 clicked it displays the first 4 records, only the others dissappear,
as it was supposed to display the last 4 records. It is also unexpected...
8 Answers, 1 is accepted
0
Hi Barbaros,
Unfortunately I cannot tell what the problem is based on your description. I suggest you check for any JavaScript errors during databinding. Also make sure the grid configuration for ajax binding is correct - this example is a good start.
If neither of this helps you can paste here the relevant code.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Unfortunately I cannot tell what the problem is based on your description. I suggest you check for any JavaScript errors during databinding. Also make sure the grid configuration for ajax binding is correct - this example is a good start.
If neither of this helps you can paste here the relevant code.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Barbaros
Top achievements
Rank 1
answered on 11 Feb 2010, 03:26 PM
Thank you Atanas,
If i can further explaiin the problem, it is easy,
I have 14 records.
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
after i click page 2 in the grid shows this
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
empty
empty
empty
empty
empty
empty
the grid refreshes and,
it shows the same first 4 records,
it is thinking these are the last 4 records, its funny
I think this time it is more clear ..
If i can further explaiin the problem, it is easy,
I have 14 records.
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
after i click page 2 in the grid shows this
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
xxx yyy zzz
empty
empty
empty
empty
empty
empty
the grid refreshes and,
it shows the same first 4 records,
it is thinking these are the last 4 records, its funny
I think this time it is more clear ..
0
Hello Barbaros,
I have never seen this behavior before. Providing a sample project will help me find the reason for the problem.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I have never seen this behavior before. Providing a sample project will help me find the reason for the problem.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Barbaros
Top achievements
Rank 1
answered on 15 Feb 2010, 01:51 PM
Hello
I have attached the screenshot, JSON response have data, but not showing
view=========================
============================
I have attached the screenshot, JSON response have data, but not showing
view=========================
<%= Html.Telerik().Grid<string[]>()
.Name("Grid")
.Columns(colums =>
{
colums.Add(o => o[0]);
colums.Add(o => o[1]);
colums.Add(o => o[2]);
})
.Ajax(ajax => ajax.Action("_AjaxBinding", "BackOffice"))
.Pageable()
.Scrollable()
%>
controller=========================
public ActionResult AjaxBinding()
{
return View();
}
[GridAction]
public ActionResult _AjaxBinding()
{
return View(new GridModel<string[]>
{
Data = _repository.LoadList("XXX_XXXXXX")
});
}
============================
0
Hello Barbaros,
Thank you for providing additional info. Now I see what the problem is. The grid can bind only to property or field expressions (c => c.CustomerID). In your case you are using indexing which we do not support.
As a workaround you can try binding to the string itself.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thank you for providing additional info. Now I see what the problem is. The grid can bind only to property or field expressions (c => c.CustomerID). In your case you are using indexing which we do not support.
As a workaround you can try binding to the string itself.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
John
Top achievements
Rank 1
answered on 16 Feb 2012, 04:06 PM
I'm having pretty much the same problem but with columns bound to model properties. My problem is different in that I'm not even getting the first refresh mentioned in the original post. I've searched through the forums pretty extensively and haven't found many posts with any response. Since this post most closely resembles my problem I thought I'd post here.
0
Greg
Top achievements
Rank 1
answered on 16 Feb 2012, 08:39 PM
I'm using index. Its a hack but works well.
I create an iterator integer ... 'Iter' and set it to 0.
Then I add the last two column to count up for each row. Model is a List<xxx>
Then add this script to index the client templates.
Iteration is by row, not by record count. But for me it works good.
I create an iterator integer ... 'Iter' and set it to 0.
Then I add the last two column to count up for each row. Model is a List<xxx>
<% int Iter = 0; %> <% Html.Telerik().Grid(Model.Students) .Name("AddClassStudentHours") .TableHtmlAttributes(new {summary = "Add Student Class Hours"}) .HtmlAttributes( new { @style = "font-size: .9em; font-family: Arial, Verdana, Helvetica, Sans-Serif; padding-bottom: 0;margin-top:0;" }) .Columns(columns => { columns.Bound(o => o.Sid) .Template(o => {%><a href="<%=Url.Content("~/Student/Summary/" + Model.Students[Iter].EncodedStudentId)%>"><%=Model.Students[Iter].Sid%></a><%}) .ClientTemplate("<a href='" + Url.Content("Student/Summary/") + "<#= EncodedStudentId #>'><#= Sid #></a>") .Title("SID") .Width(120); columns.Bound(o => o.Name) .Title("Name"); columns.Bound(o => o.Hours) .Format("{0:0.#}") .HtmlAttributes(new { @style = "text-align: right;" }) .Title("Hours") .Width(100); columns.Template(o =>{%> <%: Html.HiddenFor(model => Model.Students[Iter].AcademicYearCode)%> <%: Html.HiddenFor(model => Model.Students[Iter].StudentId)%> <%: Html.HiddenFor(model => Model.Students[Iter].CourseId)%> <%: Html.HiddenFor(model => Model.Students[Iter].Hours)%> <%: Html.HiddenFor(model => Model.Students[Iter].StudentCourseId)%> <%: Html.TextBoxFor(model => Model.Students[Iter].HoursNew, new { @class = "HoursNew", style = "font-size: 1em; font-family: Arial, Verdana, Helvetica, Sans-Serif;width: 50px;text-align: right;", @maxlength = "6", @title = "Add Hours" })%> <%}) .ClientTemplate("<input type=\"hidden\" id=\"Students_<#= index #>__.CourseId\" name=\"Students[<#= index #>].CourseId\" value=\"<#= CourseId #>\" /><input type=\"hidden\" id=\"Students_<#= index #>__.StudentCourseId\" name=\"Students[<#= index #>].StudentCourseId\" value=\"<#= StudentCourseId #>\" /><input type=\"hidden\" id=\"Students_<#= index #>__.StudentId\" name=\"Students[<#= index #>].StudentId\" value=\"<#= StudentId #>\" /><input type=\"text\" id=\"Students_<#= index #>__HoursNew\" class='HoursNew' style=\"font-size: 1em; font-family: Arial, Verdana, Helvetica, Sans-Serif;width: 50px;text-align: right;\" maxlength=\"6\" title=\"Add Hours\" name=\"Students[<#= index #>].HoursNew\" value=\"<#= HoursNew #>\" />") .Title("Add Hours") .HtmlAttributes(new { @style = "font-size: .9em; font-family: Arial, Verdana, Helvetica, Sans-Serif; vertical-align:top; text-align: center; width:20px;" }) .Width(100); columns.Template(o => {%><% Iter++; %><%}) .ClientTemplate("<#= ++index #>") .Hidden(); columns.Template(o => {%><%: Iter %><%}) .ClientTemplate("<input name='Index' value='<#= index #>' type='hidden'>") .Hidden(); }) .DataBinding(dataBinding => dataBinding.Ajax().Select("_AddHours", "Class")) .ClientEvents(events => events.OnDataBinding("onDataBinding")) .Sortable() .Footer(false) .NoRecordsTemplate("<p class='instructions'>No Records Available</p>") .Render(); %>Then add this script to index the client templates.
<script type="text/javascript"> var index = 0; function onDataBinding() { var grid = $('#AddClassStudentHours').data('tGrid'); index = (grid.currentPage - 1) * grid.pageSize; }</script>Iteration is by row, not by record count. But for me it works good.
0
Dadv
Top achievements
Rank 1
answered on 17 Feb 2012, 10:25 AM
Hi,
I think it work for Greg only because he point to a property : "Model.Students[Iter].AcademicYearCode"
Linq Expression don't like the direct indexing in Lambda (i think it's because it use reflexion in is logic).
You could try to use 'dynamic' type instead of 'string' perhaps.
Regards,
I think it work for Greg only because he point to a property : "Model.Students[Iter].AcademicYearCode"
Linq Expression don't like the direct indexing in Lambda (i think it's because it use reflexion in is logic).
You could try to use 'dynamic' type instead of 'string' perhaps.
Regards,