search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Drag&Drop with dynamic events

Asked by Kevin
17 years ago.
Hi,

I tested you you feature Drag&Drop from external resource. With your demos it works fine. I also tested it with an asp.net label in a ul and it works too.

After that I wanted to get dynamic external resources. I tried a data grid with a column for the dragable control (a asp.net label), but it doesn't work. Maybe I made a mistake ore it doens't work with dynamic resources. The grid looks like this:

asp:DataGrid
Colums
asp:TemplatColumns
ItemTemplate
asp:Label id="lblDragExt" runat="server" onmousedown=''return DayPilotSchedular.dragStart(this.parentNode, 60*<%# DataBinder.Eval(Container.DataItem, "RANGE") %>, "<%# DataBinder.Eval(Container.DataItem, "ID") %>", "<%# DataBinder.Eval(Container.DataItem, "NAME") %> ")' unselectable='on' style...

Hope you can help me.

If something isn't clear, just say.

Kind regards

Kevin
Comment posted by Dan Letecky
17 years ago.
It should work with any reasonable HTML element. <asp:Label> should be fine since it generates <span> element.

As far as I can tell from your sample, it seems that onmousedown attribute is not closed properly (it starts with " but ends with ').
Comment posted by Dan Letecky
17 years ago.
This should work better (not tested, but you should get the idea - I recommend checking the HTML output on the resulting page):

onmousedown='return DayPilotSchedular.dragStart(this.parentNode, 60*<%# DataBinder.Eval(Container.DataItem, "RANGE") %>, \'<%# DataBinder.Eval(Container.DataItem, "ID") %>\', \'<%# DataBinder.Eval(Container.DataItem, "NAME") %>\')'
Comment posted by Kevin
17 years ago.
Thanks for your answer, but your solution doens't work (the \' make problems). Now I made is this way:
- used the DataGrid ItemDataBound event
- check if item ListItemType Item or AlternatingItem
- create a ASP label
- add the mousedown attribute to the label with the return DayPilotSchedular.dragStart(... and my values)
- add the unselectable attribute
- add the cursor style
- e.Item.Cells[i].Controls.Add(_myLabel) //add my label to the cell

Maybe there is a better way to do that, but in this moment it works for me.

Kevin
Comment posted by Kevin
17 years ago.
Another qeustion concerning to this topic.

No I've all my labels for drag&drop from external in my data grid. Works fine.
But I have some events with different start and end times (e.g. 10/20/2007 08:00:00 - 10/20/2007 12:00:00, 10/20/2007 09:00:00 10/23/2007 19:00:00). How can override the DayPilotSchedular.dragStart method with this times, I've only the range value, not an value for different times.

Maybe you can help me.

Kevin
Comment posted by Dan Letecky
17 years ago.
The second parameter of dragStart() defines the duration in seconds. You can set the duration but nothing else because the exact start time will be determined after drop (and the end will be calculated using the duration).

You can also intercept the drop event by using EventMoveJavaScript (set EventMoveHandling to JavaScript). There you can detect the external drag&drop by checking "external" variable (true/false).

Is that what you were asking about?
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.