There are many similar questions already, but for some reason they do not solve my issue.
My project is to save a dynamically created page (or part of the page). The user will have the option to drag objects on screen and leave them in any order and then for this order to be saved to disc as an image.
My own research shows that I can use Draggable from JQuery and this is easy to implement. It is the saving part where I am stuck.
I followed a few links, but the image does not appear to be saving to disc and I don't think it works in IE! However, I'm happy with FireFox and so using the toDataUrl() sounds like the best approach.
Since I couldn't get it work I decided to change tactic slightly and pass the value to the code behind (C#)
The save part of my code looks like
<script>
function SaveMe() {
var canvas = document.getElementById("mycanvas");
var image = canvas.toDataUrl();
document.getElementById("hideMe").value = image;
}
</script>
When I debug in FireBug, I never reach document.getElementById("hideMe").value = image;
. I step through but can never get past var image = canvas.toDataUrl();
Is this expected behavior as I assume not but there is no error message?
The body of my HTML is
<body>
<script type="text/javascript">
$(document).ready(function () {
$('.popup_click').show(0).draggable();
});
</script>
<form id="form1" runat="server">
<div class="popup_click">
<div id="popup_title">Title</div>
</div>
<canvas id="mycanvas" class="canvas"></canvas>
<asp:HiddenField ID="hideMe" runat="server" />
<asp:Button runat="server" OnClick="ClickMe" text="Click" OnClientClick="SaveMe()"/>
</form>
</body>
What am I doing wrong? I'm working locally in debug mode, Visual Studio 2013.