You can use jquery ......
See following code we can get value of div or other as follows
= $(this).attr('id');
=$(source).find('p:first').text();
=$(source).find('p').text();
I am using following .js file for drag and drop
<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
<![CDATA[<%--Code for Drag and Drop Start--%>]]>
<style type="text/css">
.dragR{
width:auto;
height:auto;
cursor:move;
}
.drag{
width:150px;
height:20px;
cursor:move;
border:1px solid #ccc;
background:#AACCFF;
}
.dp{
opacity:0.5;
filter:alpha(opacity=50);
}
.over{
background:#FBEC88;
}
</style>
<script>
$(function(){
$('.dragR').draggable({
proxy:'clone',
revert:true,
cursor:'auto',
onStartDrag:function(){
$(this).draggable('options').cursor='not-allowed';
$(this).draggable('proxy').addClass('dp');
},
onStopDrag:function(){
$(this).draggable('options').cursor='auto';
}
});
$('.drag').draggable({
proxy:'clone',
revert:true,
cursor:'auto',
onStartDrag:function(){
$(this).draggable('options').cursor='not-allowed';
$(this).draggable('proxy').addClass('dp');
},
onStopDrag:function(){
$(this).draggable('options').cursor='auto';
}
});
$('.DivdropContainor').droppable({
onDragEnter:function(e,source){
$(source).draggable('options').cursor='auto';
$(source).draggable('proxy').css('border','1px solid red');
$(this).addClass('over');
},
onDragLeave:function(e,source){
$(source).draggable('options').cursor='not-allowed';
$(source).draggable('proxy').css('border','1px solid #ccc');
$(this).removeClass('over');
},
onDrop:function(e,source){
document.getElementById('<%=HiddenID.ClientID %>').value = $(this).attr('id');
document.getElementById('<%=HiddenProName.ClientID %>').value =$(source).find('p:first').text();
document.getElementById('<%=HiddenProRate.ClientID %>').value =$(source).find('p').text();
__doPostBack('__Page', 'CmdGetProd');
}
});
});
</script>
Check following links for refferance
http://superdit.com/2011/04/02/drag-drop-shopping-cart-using-jquery/
http://www.placona.co.uk/166/javascript/a-more-elaborated-jquery-drag-drop-cloning/
http://davidwalsh.name/mootools-drag-ajax
http://www.jqwidgets.com/blog/
http://zfcms.blogspot.in/2011/07/simple-jquery-drag-and-drop-tutorials.html