or
private void dragDropService_PreviewDragDrop(object sender, RadDropEventArgs e)
{
Console.WriteLine(e.HitTarget);
var el = e.HitTarget as RadCalendarElement;
if (el != null)
{
GridDataRowElement draggedRow = ((SnapshotDragItem)e.DragInstance).Item as GridDataRowElement;
if (draggedRow != null)
{
int TaskID = (int)draggedRow.Data.Cells["TaskID"].Value;
// determine the date we dragged to, and update the task.
return;
}
}
I am trying to copy and paste rows from my RadGridView to Excel. It works as expected when the first and last columns are visible, but if the first column is hidden the opening TABLE/TR tags in the HTML format on the clipboard are lost, and if the last column is hidden the matching closing tags are lost.
Repro: (VS2012, RadGridView Q1 2014)
Add a datasource with three columns. Right click on row header -> Copy, Paste into Excel.
Expected: The data spans three columns.
Actual: The data spans three columns. Yay!
Clipboard contents:
Version:1.0
StartHTML:00000097
EndHTML:00000239
StartFragment:00000133
EndFragment:00000203
<
HTML
>
<
BODY
>
<!--StartFragment-->
<
TABLE
><
TR
><
TD
>3</
TD
><
TD
>Tools</
TD
><
TD
>Electronics</
TD
></
TR
></
TABLE
>
<!--EndFragment-->
</
BODY
>
</
HTML
>
Hide the first column. Right click on row header -> Copy, Paste into Excel.
Expected: The data spans two columns.
Actual: All data is in a single cell.
Clipboard contents: No <TABLE><TR>.
Version:1.0
StartHTML:00000097
EndHTML:00000216
StartFragment:00000133
EndFragment:00000180
<
HTML
>
<
BODY
>
<!--StartFragment-->
<
TD
>Books</
TD
><
TD
>Chocolate</
TD
></
TR
></
TABLE
>
<!--EndFragment-->
</
BODY
>
</
HTML
>
Public
Sub
New
()
InitializeComponent()
AddHandler
Me
.RadScheduler.AppointmentEditDialogShowing,
AddressOf
RadScheduler_AppointmentEditDialogShowing
Me
.RadScheduler.AppointmentFactory =
New
AppointmentWithNewFieldsFactory
Me
.SchedulerBindingDataSource1.EventProvider.AppointmentFactory =
New
AppointmentWithNewFieldsFactory
Dim
appointmentMappingInfo
As
AppointmentMappingInfo = TryCast(
Me
.SchedulerBindingDataSource1.EventProvider.Mapping, AppointmentMappingInfo)
appointmentMappingInfo.Mappings.Add(
New
SchedulerMapping(
"CustomField"
,
"CustomFieldDatabase"
))
End
Sub
Private
appointmentDialog
As
IEditAppointmentDialog =
Nothing
Private
Sub
RadScheduler_AppointmentEditDialogShowing(sender
As
Object
, e
As
AppointmentEditDialogShowingEventArgs)
Handles
RadScheduler.AppointmentEditDialogShowing
If
Me
.appointmentDialog
Is
Nothing
Then
Me
.appointmentDialog =
New
AppointmentWithNewFieldsEditForm()
End
If
e.AppointmentEditDialog =
Me
.appointmentDialog
End
Sub
Imports
Telerik.WinControls.UI
Public
Class
AppointmentWithNewFields
Inherits
Appointment
Public
Sub
New
()
MyBase
.
New
()
End
Sub
Private
_CustomField
As
Integer
Public
Property
CustomField()
As
Integer
Get
Return
Me
._CustomField
End
Get
Set
(value
As
Integer
)
If
Me
._CustomField <> value
Then
Me
._CustomField = value
Me
.OnPropertyChanged(
"CustomField"
)
End
If
End
Set
End
Property
Imports
Telerik.WinControls.UI
Public
Class
AppointmentWithNewFieldsEditForm
Inherits
Telerik.WinControls.UI.Scheduler.Dialogs.EditAppointmentDialog
Public
Sub
New
()
InitializeComponent()
End
Sub
Protected
Overrides
Sub
LoadSettingsFromEvent(
ByVal
ev
As
IEvent)
MyBase
.LoadSettingsFromEvent(ev)
Dim
appointmentWithNewFields
As
AppointmentWithNewFields = TryCast(ev, AppointmentWithNewFields)
If
appointmentWithNewFields IsNot
Nothing
Then
Me
.ComboBoxCustomField.SelectedValue = appointmentWithNewFields.CustomField
End
If
End
Sub
Protected
Overrides
Sub
ApplySettingsToEvent(
ByVal
ev
As
IEvent)
Dim
appointmentWithNewFields
As
AppointmentWithNewFields = TryCast(ev, AppointmentWithNewFields)
If
appointmentWithNewFields IsNot
Nothing
Then
appointmentWithNewFields.CustomField=
Me
.ComboBoxCustomField.SelectedValue
End
If
MyBase
.ApplySettingsToEvent(ev)
End
Sub
Protected
Overrides
Function
CreateNewEvent()
As
IEvent
Return
New
AppointmentWithNewFields()
End
Function
Imports
Telerik.WinControls.UI
Public
Class
AppointmentWithNewFieldsFactory
Implements
IAppointmentFactory
#Region "IAppointmentFactory Members"
Public
Function
CreateNewAppointment()
As
IEvent
Implements
IAppointmentFactory.CreateNewAppointment
Return
New
AppointmentWithNewFields()
End
Function
#End Region
End
Class