When I try to bind an HtmlTextBox server side no data is displayed on the report, I don't know when this stopped working because a client of mine just reported it happening after my last update to his system using the latest telerik Reporting build. This was working fine before that.
Here's the code, I can't find anything wrong with it.
Here's the code, I can't find anything wrong with it.
private void GetAppointments() |
{ |
StartDate = new DateTime(2008, 10, 1); |
EndDate = new DateTime(2008, 11, 1); |
MemberId = 10; |
Priority = null; |
Color = null; |
EmployeeId = null; |
appointments = (from a in _context.Appointment |
where a.Start >= StartDate && |
a.End < EndDate && |
a.WorkOrderId > 0 && |
(a.MemberId.Equals(MemberId) || MemberId == null) && |
(a.WorkOrder.Job.Priority.Equals(Priority) || Priority == null) && |
(a.Color.Equals(Color) || Color == null) && |
(a.WorkOrder.WorkOrderResourceList.Select(r => (long?)r.EmployeeId).ToList().Contains(EmployeeId) || EmployeeId == null) |
orderby a.Start |
select a).ToList(); |
} |
void Schedule_NeedDataSource(object sender, EventArgs e) |
{ |
GetAppointments(); |
tblAppointments.DataSource = appointments; |
} |
void htmlWorkOrdeDetails_ItemDataBound(object sender, EventArgs e) |
{ |
Telerik.Reporting.Processing.HtmlTextBox details = (Telerik.Reporting.Processing.HtmlTextBox)sender; |
var workOrder = details.DataObject["WorkOrder"] as Entities.WorkOrder; |
var color = (AppointmentColor)details.DataObject["ColorAppointmentColor"]; |
var subject = (string)details.DataObject["Subject"]; |
var workOrderDetails = new System.Text.StringBuilder(); |
if (workOrder != null) |
{ |
var job = workOrder.Job; |
var jobSite = job.Address; |
var customer = job.Customer; |
var resources = string.Empty; |
switch (workOrder.AssignedToType) |
{ |
case 0: |
resources = "Not Assigned"; |
break; |
case 1: |
resources = string.Join(", ", workOrder.WorkOrderResourceList.Select(r => (r.Employee.FirstName + " " + r.Employee.LastName)).ToArray()); |
break; |
case 2: |
resources = workOrder.AssignedToContractor.Name; |
break; |
} |
workOrderDetails.Append("<div style='background-color: white'>"); |
workOrderDetails.AppendFormat("<b>Work Order # {0}</b><br/>", workOrder.Number); |
workOrderDetails.AppendFormat("<b>Job Site:</b> {0}, {1}, {2}. {3}<br/>", HttpUtility.HtmlEncode(jobSite.AddressMember), HttpUtility.HtmlEncode(jobSite.City.Name), jobSite.State.Abbreviation, jobSite.ZipCode.ZipCodeMember); |
workOrderDetails.AppendFormat("<b>Customer:</b> {0}<br/>",HttpUtility.HtmlEncode(customer.Name)); |
workOrderDetails.AppendFormat("<b>Job Name:</b> {0}<br/>", HttpUtility.HtmlEncode(job.Name)); |
workOrderDetails.AppendFormat("<b>Assigned To:</b> {0}<br/>", HttpUtility.HtmlEncode(resources)); |
workOrderDetails.AppendFormat("<b>Notes:</b> {0}", string.IsNullOrEmpty(subject) ? "N/A" : HttpUtility.HtmlEncode(subject)); |
workOrderDetails.Append("</div>"); |
} |
details.Style.BorderWidth.Default = new Unit(1); |
details.Style.BorderColor.Default = ColorTranslator.FromHtml(color.Name); |
details.Style.BackgroundColor = ColorTranslator.FromHtml(color.Name); |
details.Value = workOrderDetails.ToString(); |
} |