<telerik:RadGrid ID="FundReportGrid" runat="server" GridLines="None"
Skin="Office2010Blue" AllowPaging="true" AllowSorting="true"
onexcelmlexportrowcreated="FundReportGrid_ExcelMLExportRowCreated"
onexcelmlexportstylescreated="FundReportGrid_ExcelMLExportStylesCreated"
onneeddatasource="FundReportGrid_NeedDataSource"
onpageindexchanged="FundReportGrid_PageIndexChanged"
onpagesizechanged="FundReportGrid_PageSizeChanged"
onpdfexporting="FundReportGrid_PdfExporting"
onselectedindexchanged="FundReportGrid_SelectedIndexChanged"
onsortcommand="FundReportGrid_SortCommand"
onitemcreated="FundReportGrid_ItemCreated">
<ExportSettings FileName="FundingIssueReport" OpenInNewWindow="true" IgnorePaging="true" ExportOnlyData="true">
<Excel Format="ExcelML" FileExtension="xls" />
<Pdf FontType="Subset" PaperSize="Letter" />
</ExportSettings>
<MasterTableView AutoGenerateColumns="false" AllowMultiColumnSorting="true">
<RowIndicatorColumn>
<HeaderStyle Width="1px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="1px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn HeaderText="Location" DataField="LOC" UniqueName="LOC" ReadOnly="true" SortExpression="LOC" HeaderButtonType="TextButton" >
<HeaderStyle Width="1px" />
<ItemStyle Width="1px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Job" DataField="JOB" UniqueName="JOB" ReadOnly="true" SortExpression="JOB" HeaderButtonType="TextButton" >
<HeaderStyle Width="1px" />
<ItemStyle Width="1px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Title" DataField="TITLE" UniqueName="TITLE" ReadOnly="true" SortExpression="TITLE" HeaderButtonType="TextButton" >
<HeaderStyle Width="1px" />
<ItemStyle Width="1px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="PD Code" DataField="PDIEM_CODE" UniqueName="PDIEM_CODE" ReadOnly="true" SortExpression="PDIEM_CODE" HeaderButtonType="TextButton" >
<HeaderStyle Width="1px" />
<ItemStyle Width="1px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Service Days" DataField="SERVICE_DAYS" UniqueName="SERVICE_DAYS" ReadOnly="true" SortExpression="SERVICE_DAYS" HeaderButtonType="TextButton" >
<HeaderStyle Width="1px" />
<ItemStyle Width="1px" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>
DataSet
ds = new DataSet();
string jobstatus = string.Empty;
ds =
PerDiemCFNReport.CFN_Funding_Issue_Report(FiscalYear.ToString(), CFNList1.CFN, Location, JobTextBox.Text.Trim(), EMP_IDs1.SelectedID, EMP_IDs1.SelectedIDType, ref jobstatus);
if ((ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0) && (ds.Tables[0] != null))
{
Session[
"FundReportData"] = ds.Tables[0];
lblError.Text =
String.Empty;
lblError.Attributes.Add(
"display", "none");
FundingIssueReport.Visible =
true;
ErrorImage.Visible =
false;
BindFundIssueData();
FYDetail = CFNList1.Year;
GetDetailReport();
}
else
{
lblError.Visible =
true;
lblError.Text =
"No Data found for the given search criteria";
FundingIssueReport.Visible =
false;
FundingIssueDetailReport.Visible =
false;
ErrorImage.Visible =
true;
return;
}
private
void BindFundIssueData()
{
RadGrid FundIssueGrid = (RadGrid)FundingIssueReport.FindItemByValue("FundDataReport").FindControl("FundReportGrid");
FundIssueGrid.MasterTableView.CurrentPageIndex = 0;
FundIssueGrid.DataSource = Session[
"FundReportData"];
FundIssueGrid.DataBind();
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ICEAspPriceCompare.Default" %>
<!DOCTYPE html>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManagerMain"
Runat
=
"server"
>
</
telerik:RadScriptManager
>
<
asp:SqlDataSource
ID
=
"SqlDataSourceCatalog"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:icelocalmerchandiseConnectionString %>" SelectCommand="SELECT * FROM [Catalogs]"></
asp:SqlDataSource
>
<
telerik:RadGrid
ID
=
"RadGridMain"
runat
=
"server"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
AutoGenerateDeleteColumn
=
"True"
AutoGenerateEditColumn
=
"True"
CellSpacing
=
"0"
DataSourceID
=
"SqlDataSourceCatalog"
GridLines
=
"None"
Skin
=
"Metro"
OnItemCommand
=
"RadGridMain_ItemCommand"
>
<
MasterTableView
datakeynames
=
"Id"
datasourceid
=
"SqlDataSourceCatalog"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
></
CommandItemSettings
>
<
RowIndicatorColumn
Visible
=
"True"
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
Visible
=
"True"
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Id"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter Id column"
HeaderText
=
"Id"
ReadOnly
=
"True"
SortExpression
=
"Id"
UniqueName
=
"Id"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MaritzCatalogId"
FilterControlAltText
=
"Filter MaritzCatalogId column"
HeaderText
=
"MaritzCatalogId"
SortExpression
=
"MaritzCatalogId"
UniqueName
=
"MaritzCatalogId"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Title"
FilterControlAltText
=
"Filter Title column"
HeaderText
=
"Title"
SortExpression
=
"Title"
UniqueName
=
"Title"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Description"
FilterControlAltText
=
"Filter Description column"
HeaderText
=
"Description"
SortExpression
=
"Description"
UniqueName
=
"Description"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"UPC"
FilterControlAltText
=
"Filter UPC column"
HeaderText
=
"UPC"
SortExpression
=
"UPC"
UniqueName
=
"UPC"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Cost"
DataType
=
"System.Decimal"
FilterControlAltText
=
"Filter Cost column"
HeaderText
=
"Cost"
SortExpression
=
"Cost"
UniqueName
=
"Cost"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MSRP"
FilterControlAltText
=
"Filter MSRP column"
HeaderText
=
"MSRP"
SortExpression
=
"MSRP"
UniqueName
=
"MSRP"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MktAverage"
DataType
=
"System.Decimal"
FilterControlAltText
=
"Filter MktAverage column"
HeaderText
=
"MktAverage"
SortExpression
=
"MktAverage"
UniqueName
=
"MktAverage"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MktHigh"
DataType
=
"System.Decimal"
FilterControlAltText
=
"Filter MktHigh column"
HeaderText
=
"MktHigh"
SortExpression
=
"MktHigh"
UniqueName
=
"MktHigh"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MktLow"
FilterControlAltText
=
"Filter MktLow column"
HeaderText
=
"MktLow"
SortExpression
=
"MktLow"
UniqueName
=
"MktLow"
>
</
telerik:GridBoundColumn
>
<
telerik:GridImageColumn
DataImageUrlFields
=
"ImageLink"
FilterControlAltText
=
"Filter column1 column"
ImageHeight
=
""
ImageWidth
=
"75px"
UniqueName
=
"column1"
>
</
telerik:GridImageColumn
>
<
telerik:GridButtonColumn
CommandName
=
"UPC"
FilterControlAltText
=
"Filter column column"
Text
=
"Market Price"
UniqueName
=
"column"
>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
></
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
</
telerik:RadGrid
>
</
form
>
</
body
>
</
html
>
and here's the codebehind file
using System;
using Telerik.Web.UI;
namespace ICEAspPriceCompare
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void RadGridMain_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName.Equals("UPC"))
{
var item = (GridDataItem)e.Item;
string id = item.OwnerTableView.DataKeyValues[item.ItemIndex]["Id"].ToString();
Response.Redirect("http://www.cnn.com", true);
//Response.Redirect("GoogleSimpleLookup.aspx?Id=" + id, true);
}
}
}
}
I am trying to prevent the user from resizing an appointment such that it would overlap with another appointment within the same resource. The problem seems to be when the end of the appointment being resized is dragged over another that is only 1 day in duration, it's not detecting that appointment as being within the start and end dates. I'm using the timeline view where each slot is 1 day.
I can set the start time that it passes to the function to one ms less where it spans the day boundary and it works. If I set it back to 00:00:00 it doesn't.
The code I'm using is below, ResizingTarget() is the handler for the scheduler's OnClientAppointmentResizeEnd event.
function
ResizingTarget(sender, args)
{
if
(!isSlotFree(args.get_targetSlot(), args.get_appointment()))
{
args.get_appointment().get_element().style.border =
"0px none black"
;
args.set_cancel(
true
);
}
else
{
var
apt = args.get_appointment();
var
newTime = args.get_newStartTime();
var
featureId = apt.get_id();
// Call web service to update target
}
}
function
isSlotFree(targetSlot, appointment)
{
//Get start time of target calendar slot
var
startTime = targetSlot.get_startTime();
//Ensure reference to RadScheduler client object
if
(_sched ==
null
)
_sched = $find(
"<%= targets.ClientID %>"
);
//Calculate end time (to create span that cannot be overlapped)
var
endTime =
new
Date(startTime.getTime() + 86400000);
//24hr period
startTime =
new
Date(startTime.getTime());
//Determine if appt being moved overlaps with another appointment
return
!overlapsWithAnotherAppointment(appointment, startTime, endTime);
}
function
overlapsWithAnotherAppointment(appointment, startTime, endTime)
{
if
(_sched ==
null
)
_sched = $find(
"<%= targets.ClientID %>"
);
// Get all appts in range of start and end time
var
appointments = _sched.get_appointments().getAppointmentsInRange(startTime, endTime);
if
(appointments.get_count() == 0)
return
false
;
var
strID =
""
;
var
apptCnt = appointments.get_count();
for
(
var
i = 0; i < apptCnt; i++)
{
if
(appointments._array[i]._id != appointment._id)
{
if
(appointments._array[i]._serializedResources[0].key == appointment._resources._array[0]._key)
return
true
;
}
}
return
false
;
}
<
telerik:RadFormDecorator
ID
=
"QsfFromDecorator"
runat
=
"server"
DecoratedControls
=
"All"
EnableRoundedCorners
=
"false"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid2"
LoadingPanelID
=
"RadAjaxLoadingPanel2"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
<!--
//this method calculates whether you have reached the bottom when dragging the vertical grid scroll
function IsScrolledToBottom(scrollArea) {
var currentPosition = scrollArea.scrollTop + scrollArea.clientHeight;
return currentPosition == scrollArea.scrollHeight;
}
-->
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowPaging
=
"True"
PageSize
=
"14"
AllowSorting
=
"True"
AllowCustomPaging
=
"True"
VirtualItemCount
=
"50000"
OnColumnCreated
=
"RadGrid1_ColumnCreated"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
CellSpacing
=
"0"
GridLines
=
"None"
Skin
=
"Web20"
>
<
PagerStyle
Mode
=
"NumericPages"
></
PagerStyle
>
<
MasterTableView
TableLayout
=
"Fixed"
>
</
MasterTableView
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"True"
EnableVirtualScrollPaging
=
"True"
UseStaticHeaders
=
"True"
SaveScrollPosition
=
"True"
></
Scrolling
>
</
ClientSettings
>
</
telerik:RadGrid
>