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

[Solved] Multiple display symptoms when making any Ajax call

1 Answer 105 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.
Luke
Top achievements
Rank 1
Luke asked on 24 May 2011, 05:45 PM

Hello forum members,

When I load a page (containing a grid) directly from the URL, all the grid contents display as expected.
However, whenever I sort, apply a filter, or simply refresh using the button in the footer of the grid, a few things show up differently:

1. A column containing hyperlinks no longer displays its contents (so, a column of empty cells shows up where a column of links previously was).
2. A column displaying enum values no longer displays the enum value strings, but the corresponding ints instead.
3. (minor issue, but may assist diagnosis) A column displaying dates shows (1/1/1) where before showing (1/1/0001).

Based on my browsing of these forums, I suspect I am misunderstanding something about Server/Client templates or Ajax data binding. But, being a newb in these things, it would help if someone could explain these things at a slightly lower level than the tutorials, or perhaps point me more specifically to the problem.

Thank you!

The grid code in my view (near identical to the grid overview code):

@model IEnumerable<MyNamespace.Models.Monitoring.DeviceInfoModel>
  
@{
    ViewBag.Title = "Devices";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
  
<h2>Devices</h2>
  
@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(dataKeys => dataKeys.Add(o => o.Info.Id))
        .Columns(columns =>
        {
            columns.Command(commands => commands.Delete()).Width(50);
            columns.Bound(o => o.Info.Name).Title("Name").Width(100);
            columns.Bound(o => o.Info.LastUserName).Title("User name").Width(50);
            columns.Bound(o => o.Info.Model).Title("Device model").Width(100);
            columns.Bound(o => o.Info.PushNotificationTypes).Title("Notification").Width(50);
            columns.Bound(o => o.Info.PhoneNumber).Title("Phone number").Width(100);
            columns.Bound(o => o.Info.OSVersion).Title("OS version").Width(50);
            columns.Bound(o => o.Info.SoftwareVersion).Title("Client version").Width(100);
            columns.Bound(o => o.Info.LastAccess)/*.Format("{0:MM/dd/yyyy}")*/.Title("Last logon").Width(100);
            columns.Bound(o => o.Info.LastNotification).Title("Last notification").Width(100);
        })
        .DataBinding(dataBinding =>
        {
            dataBinding.Server().Select("Devices", "Monitoring", new { ajax = true });
            dataBinding.Ajax()
                    .Select("_Devices", "Monitoring")
                    .Delete("_DevicesDelete", "Monitoring")
                    .Enabled(true);
        })
        .Scrollable(scrolling => scrolling.Enabled(true))
        .Sortable(sorting => sorting.Enabled(true))
        .Pageable(paging => paging.Enabled(true))
        .Filterable(filtering => filtering.Enabled(true))
        .Groupable(grouping => grouping.Enabled(true))
        .Footer(true)
)

(Yes, the hyperlinks currently just point right back to the same page. They're just placeholders, for now)

1 Answer, 1 is accepted

Sort by
0
Luke
Top achievements
Rank 1
answered on 24 May 2011, 06:50 PM
(Update)

Now using the Telerik-API Delete command, bound with Ajax. It displays properly, but the appropriate methods in the Controller aren't getting called. Updating View code above...
Tags
Grid
Asked by
Luke
Top achievements
Rank 1
Answers by
Luke
Top achievements
Rank 1
Share this question
or