Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
Webtexteditor
posted

Hi,

 

I basically drag and drop the webtexteditor to the drag drop framework.

but the webtexteditor doesnot show up.

here is my code.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<%

 

@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"

%>

<%

 

@ Register Assembly

="Infragistics35.WebUI.UltraWebCalcManager.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"

 

 

Namespace="Infragistics.WebUI.UltraWebCalcManager" TagPrefix="igcalc"

%>

<%

 

@ Register assembly="Infragistics.WebUI.UltraWebChart" namespace="Infragistics.WebUI.UltraWebChart" tagprefix="igchart"

%>

<%

 

@ Register assembly="Infragistics35.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.EditorControls" tagprefix="ig"

%>

<!

 

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<

 

 

html xmlns

="http://www.w3.org/1999/xhtml">

<

 

 

head runat

="server">

 

 

<title></title

>

</

 

 

head

>

<

 

 

body

>

<

 

 

style type="text/css"

>

 

 

body

{

/

 

/**background-image: url(../images/DragDrop/cart_bg.png); **/

/

}

 

 

img

{

 

 

border: 0px

;

}

 

 

.floatDIV

{

 

 

float: left

;

 

 

padding-right: 10px

;

}

 

 

.popupBody

{

/

 

/**background-image: url(../images/DragDrop/cart_bg.png);**/

/

}

 

 

</style

>

 

 

<form id="form1" runat

="server">

 

 

 

<asp:ScriptManager ID="ScriptManager1" runat

="server">

 

 

<Scripts

>

 

 

<asp:ScriptReference Assembly="Infragistics35.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Name="Infragistics.Web.UI.SharedScripts.igDragDrop.js"

/>

 

 

<asp:ScriptReference Assembly="Infragistics35.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Name="Infragistics.Web.UI.Scripts.5_igObjects.js"

/>

 

 

<asp:ScriptReference Assembly="Infragistics35.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Name="Infragistics.Web.UI.SharedScripts.igAnimation.js"

/>

 

 

</Scripts

>

</

 

 

asp:ScriptManager

>

<

 

 

script type

="text/javascript">

Sys.Application.add_load(appLoaded);

 

 

function

appLoaded() {

 

 

var ddb = new

$IG.DragDropBehavior();

 

 

var list = $get("imageList"

);

 

 

var

count = list.childNodes.length;

 

 

for (var

i = 0; i < count; i++) {

 

 

var

child = list.childNodes[i];

 

 

if

(child.getAttribute)

ddb.addSourceElement(child);

}

ddb.addTargetElement($get(

 

"cartAreaDIV"), true

);

ddb.addDragChannels([

 

"cart"

]);

ddb.addDropChannels([

 

"cart"

]);

ddb.get_events().addDropHandler(dropHandler);

}

 

 

var removeBehavior = null

;

 

 

function

dropHandler(source, evntArgs) {

 

 

var panel = $get("cartAreaDIV"

);

 

 

var

eleID = evntArgs.get_manager().get_source().element.id;

 

 

var

ddb = removeBehavior;

 

 

if

(!ddb) {

removeBehavior = ddb =

 

new

$IG.DragDropBehavior();

ddb.addTargetElement($get(

 

"trashAreaDIV"), true

);

ddb.addDragChannels([

 

"trash"

]);

ddb.addDropChannels([

 

"trash"

]);

ddb.get_events().addDropHandler(removeHandler);

}

 

 

if (document.getElementById(eleID + "_div"

)) {

 

 

var spanSource = document.getElementById(eleID + "_span"

).innerHTML;

document.getElementById(eleID +

 

"_span"

).innerHTML = parseInt(spanSource) + 1;

}

 

else

{

 

 

var div = document.createElement("div"

);

div.id = eleID +

 

"_div"

;

div.className =

 

"floatDIV"

;

 

 

var spanpre = document.createElement("span"

);

spanpre.innerHTML = eleID +

 

" ("

;

 

 

var span = document.createElement("span"

);

span.innerHTML =

 

"1"

;

span.id = eleID +

 

"_span"

;

 

 

var spanend = document.createElement("span"

);

spanend.innerHTML =

 

")"

;

 

 

var img = document.createElement("img"

);

img.src = evntArgs.get_manager().get_source().element.src;

img.style.width =

 

"45px"

;

img.style.height =

 

"44px"

;

img.align =

 

"middle"

;

div.appendChild(img);

div.appendChild(spanpre);

div.appendChild(span);

div.appendChild(spanend);

panel.appendChild(div);

ddb.addSourceElement(div);

}

}

 

 

function

removeHandler(source, evntArgs) {

 

 

var panel = $get("cartAreaDIV"

);

 

 

var

eleID = evntArgs.get_manager().get_source().element.id;

eleIDshort = eleID.replace(

 

"_div", ""

);

 

 

var panel = $get("cartAreaDIV"

);

 

 

var spanSource = document.getElementById(eleIDshort + "_span"

).innerHTML;

 

 

if

(parseInt(spanSource) == 1) {

panel.removeChild(document.getElementById(eleID));

}

 

else

{

document.getElementById(eleIDshort +

 

"_span"

).innerHTML = parseInt(spanSource) - 1;

}

}

 

 

 

 

</script

>

 

 

<

 

 

div id="imageList" style="height: 70px; width: 600px; top: 65px; position: relative; text-align: center;

">

 

 

 

<ig:WebTextEditor ID="WebTextEditor1" runat="server" TextMode

="MultiLine">

 

 

</ig:WebTextEditor

>

</

 

 

div

>

<

 

 

div id="cartContainerDIV" style="position: absolute; top: 330px; left: 30px; width: 761px; height: auto;">

 

 

<div id="trashAreaDIV" style="position: absolute; top:0px; right: -60px; z-index:1; width:129px; height:53px; "></div

>

 

 

<div id="cartDIV" style="position: relative; background-image: url(../images/DragDrop/eng/cart_area.png); background-repeat: no-repeat; width: 761px; height: 207px;

">

 

 

<div id="cartAreaDIV" style="position: relative; left: 17px; top: 65px; width: 728px; height: 125px; "></div

>

 

 

</div>

 

 

</div

>

</

 

 

form

>

 

</

 

 

body

>

</

 

 

html

>

 

 

 

  • 24497
    Suggested Answer
    posted

    Hi Smuddam,

    I eventually reformatted attached codes and tested them.
    Note: please do not copy/paste from richtext sources like VisualStudio editor. If you want to provide codes, then you may attach a file into the Options tab. If codes are small, then you may temporary paste copied text into notepad, notepad++, or similar plain-text editor and copy/paste from that editor text-content only.

    I guess in your application you copied/pasted codes from one of the samples which had IMG objects as targets and created their copies. You can not do a similar copy with a server generated control, because only single element per control can exist on client. However, you may move that element to another container using drag-drop.

    If you want only to move editor to another location, then you may use built-in drag-drop action and there is no need in any channels, handlers, etc. For example:
    function appLoaded()
    {
     var ddb = new $IG.DragDropBehavior();
     var list = $get("imageList");
     var count = list.childNodes.length;
     for (var i = 0; i < count; i++)
     {
      var child = list.childNodes[i];
      if (child.getAttribute)
      ddb.addSourceElement(child);
     }
     ddb.addTargetElement($get("cartAreaDIV"), true);
     ddb.set_defaultDropAction($IG.DragDropAction.Append);
    }

    Also adding all children of "list" as targets is not good idea, because WebTextEditor renders several hidden elements, which could not be moved anyway, but fill up your source container by dummies.

    If you want to keep your architecture with channels and trash, then below are fixed codes for you. You can use all your original codes beside commented lines. If you do not use default drop action, then you are responsible for all moves (remove source from its old parent and insert it into new target).

    function dropHandler(source, evntArgs)
    {
     ...
     if (document.getElementById(eleID + "_div"))
      ...
     else
     {
      ...
    //  var img = document.createElement("img");
    //  img.src = evntArgs.get_manager().get_source().element.src;
    //  img.style.width = "45px";
    //  img.style.height = "44px";
    //  img.align = "middle";
    //  div.appendChild(img);

      var src = evntArgs.get_manager().get_source().element;
      src.parentNode.removeChild(src);
      div.appendChild(src);

      div.appendChild(spanpre);
      ...
     }
    }