Monday, June 29, 2015

Kendo Grid - Not Sorting when using DataSource Read for Binding

I had a Kendo Grid that was using server side binding, I think that is what it is called, to get the data. The problem I was having was the Sorting. The grid was marked Sortable() and appeared to be doing something, just not sorting! I found that if I added .ServerOperation(false) to the DataSource attributes this fixed the issue and it began sorting correctly. Not sure if there are any load consequences to this or not but it does work.
  1. @(Html.Kendo().Grid<UsageStatics>()
  2. .Deferred()
  3. .Name("MyGrid")
  4. .Columns(columns =>
  5. {
  6. columns.Bound(p => p.UserName).Title("User")
  7. columns.Bound(p => p.LoginDate).Title("Last Login")
  8. })
  9. .Pageable(pager => pager
  10. .Refresh(true))
  11. .Sortable(s => s.SortMode(GridSortMode.MultipleColumn).AllowUnsort(true))
  12. .Filterable()
  13. .Scrollable()
  14. .Events(e => e.DataBound("_onDataBound"))
  15. .DataSource(dataSource => dataSource
  16. .Ajax()
  17. .PageSize(200)
  18. .Events(events => events.Error("errorHandler"))
  19. .ServerOperation(false) //allows sorting...
  20. .Read(read => read.Action("GetUsers", "MyControllerName").Data("gridData"))
  21. )
  22. )

Friday, June 26, 2015

Report Viewer Not Running Local Report in IE11

I was working on a project that ran local SQL Reports using the Report Viewer control. As I was working with the reports, I was only testing in FireFox which was fine, however, I later found that the reports were not running in IE! I was running IE11 at the time. There are numerous fixes for this issue including adding the meta tag (which did not work for me). I selected the modification to the Global.asax file and that corrected the issue.
I am running MVC, .NET Framwork 4
  1. protected void Application_BeginRequest(object sender, System.EventArgs e) {
  2. // Bug fix for MS SSRS Blank.gif 500 server error missing parameter IterationId
  3. // https://connect.microsoft.com/VisualStudio/feedback/details/556989/
  4. if (HttpContext.Current.Request.Url.PathAndQuery.StartsWith("/Reserved.ReportViewerWebControl.axd") &&
  5. !System.String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["ResourceStreamID"]) &&
  6. HttpContext.Current.Request.QueryString["ResourceStreamID"].ToLower().Equals("blank.gif"))
  7. {
  8. Context.RewritePath(System.String.Concat(HttpContext.Current.Request.Url.PathAndQuery, "&IterationId=0"));
  9. }
  10. }