Hello guys. I help some help here(badly)!
item, and it can be drop into another div and display in text.
So here's my question how do i send this text into my database(i'm using rest service here)
THANKS IN ADVANCE!!!!!
My html code : (client)
asp:DataList ID="DataList1" runat="server" DataKeyField="FoodID" RepeatDirection="Horizontal" RepeatColumns="3" >
<ItemTemplate>
<div id="div1" class="block">
<asp:Label ID="FoodIDLabel" runat="server" Text='<%# Eval("FoodID") %>' Visible="False" />
<br />
<asp:Label ID="FoodNameLabel" runat="server" Text='<%# Eval("FoodName") %>' />
<br />
Calories:
<asp:Label ID="CaloriesLabel" runat="server" Text='<%# Eval("Calories") %>' />
<br />
image:
<asp:Image ID="Image1" runat="server" />
<br />
<br /></div>
</ItemTemplate>
</asp:DataList>
<div id="div2" class="drop">Drag Food To Here<br />
<br />
</div>
<script language="javascript" type="text/javascript">
window.Error = function (msg) {
alert(msg);
}
JavaScript :
$(document).ready(function () {
$(".block").draggable({ helper: 'clone' });
$(".drop").droppable({
accept: ".block",
activeClass: 'droppable-active',
hoverClass: 'droppable-hover',
drop: function (ev, ui) {
$("<div></div>").text(ui.draggable.text()).appendTo(this);
this.value = $(ui.draggable).text();
}
});
});
Lastly my rest service for create : (.cs)
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "InsertPlan?PlanDate={Date}&Category={Category}&FoodName={food}&TCalories={calories}")]
string InsertPlan(string Date, string Category, string food, string calories);