Solved

drag and drop  target source

Posted on 2009-07-05
6
213 Views
Last Modified: 2012-08-13
I need code for drag and drop functionality in javascript.

Here is my scenario.  

I have calendar which is developed dynamically by aspx.net code. Each day  has some divs as children. I have to drag  div from one day and drop to another day. After dropping custom functionality should be called.
0
Comment
Question by:ravifine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 4

Accepted Solution

by:
stevepicks earned 125 total points
ID: 24780261
0
 

Author Comment

by:ravifine
ID: 24781233
I'm using asp calendar control. I'm attaching div to certain dates. I should drag the divs within dates.
I'm unable to do that event If I use javascirpt
0
 

Author Comment

by:ravifine
ID: 24781273
Here is calender conrol code behind. on Calender2_DayRender I'm adding div. This div should drag and droppable in any day of calendar. Some how it didn't work with above javasript file.
protected void Calendar2_DayRender(object sender, DayRenderEventArgs e)
    {
 
 
 
        e.Cell.ID = "cell" + i;
 
        
 
        if (!e.Day.IsOtherMonth)
        {
            e.Cell.Attributes.Add("date", e.Day.Date.ToShortDateString());
            //e.Cell.Style.Add("position", "relative");
            //e.Cell.Style.Add("z-index", "1");
            //jvScriptCell.Append("DragHandler.triggerCalendarPostBack(document.getElementById('" + e.Cell.ClientID + "'));  ");
 
        }
        else
        { 
            e.Cell.Attributes.Add("date", e.Day.Date.ToShortDateString());
           // e.Cell.Style.Add("position", "relative");
            //e.Cell.Style.Add("z-index", "1");
            e.Cell.Attributes.Add("class","forbid");
           
        }
        if (i == 25 || i == 22)
        {
 
            System.Web.UI.HtmlControls.HtmlGenericControl div = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
            div.Attributes.Add("schduleId","s" + i);
            div.Attributes.Add("EventId", "e" + i);
            div.Attributes.Add("class", "drag t1");
            div.ID = "div" + i;
            // jvScriptSchedule.Append("DragHandler.attach(document.getElementById('" + div.ClientID + "'));  ");
            //jvScriptSchedule.Append("document.getElementById('" + div.ClientID + "').onmousedown = handler_onmousedown;");
            e.Cell.Controls.Add(div);
        }
 
        if (i++ == 41)
        {
 
           // Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "ScheduleScript", jvScriptSchedule.ToString(), true);
 
           // Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "CellScript", jvScriptCell.ToString(), true);
 
 
 
        }
 
 
 
    } 

Open in new window

0
 

Author Comment

by:ravifine
ID: 24784645
it's working now. thanks StevePicks
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 37304481
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Non-Resizable Pharagraph 2 17
ModalPopup  question 22 38
Compute age Html 2 24
How to pass values to HTML-5 attribute dynamically? 24 44
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question