Hi @Donald Symmons,
After some research, I finally found something that might help you. You can use localStorage object to save location and font size color etc.
Because you need to leave the current page and come back with everything there, it is best to upload the image to the server and then save it using a Session.
I wrote a simple example for your reference:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script>
var positions = JSON.parse(localStorage.positions || "{}");
$(function () {
var d = $("[id=draggable1]").attr("id", function (i) {
return "draggable_" + i
})
$.each(positions, function (id, pos) {
$("#" + id).css(pos)
})
d.draggable({
containment: "#containment-wrapper",
scroll: false,
stop: function (event, ui) {
positions[this.id] = ui.position
localStorage.positions = JSON.stringify(positions)
}
});
$("#clear").click(function () {
window.localStorage.clear();
window.location.reload();
});
});
</script>
<script type="text/javascript">
function ChangeSize(FontValue) {
document.getElementById("LabelName").style.fontSize = FontValue;
document.getElementById("LabelDate").style.fontSize = FontValue;
localStorage.setItem("font-size", FontValue);
}
window.onload = function () {
var a = document.getElementById("LabelName");
var b = document.getElementById("LabelDate");
var fonts = localStorage.getItem("font-size");
a.style.fontSize = fonts;
b.style.fontSize = fonts;
}
</script>
<style>
.draggable {
width: 200px;
height: 200px;
padding: 0.5em;
float: left;
margin: 0 10px 10px 0;
cursor: move;
}
.draggable, a {
cursor: move;
}
#draggable, #draggable2 {
margin-bottom: 20px;
cursor: move;
}
#draggable {
cursor: move;
}
#draggable2 {
cursor: e-resize;
}
#containment-wrapper {
width: 800px;
height: 500px;
padding: 10px;
}
h3 {
clear: left;
}
</style>
<style>
.draggable {
width: 200px;
height: 200px;
padding: 0.5em;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label17" runat="server" Style="color: #ba2424; font-weight: 500;">Upload your certificate design, leave the name and date empty on the design image (referred format is .png)</asp:Label>
<div class="input-group">
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="btnUpload" Text="Upload" runat="server" OnClick="UploadFile" />
</div>
<div id="containment-wrapper">
<div class="grids">
<div class="row col-sm-12" style="width: 100%; margin: 0 auto; padding: 6px; margin-right: auto; margin-left: auto; margin-bottom: 20px;">
<div class="col-sm-8" style="width: 100%; margin: 0 auto; padding: 6px; margin-bottom: 20px;">
<div class="row">
<div runat="server" class="certcontain" id="output">
<asp:Image ID="Image1" runat="server" />
</div>
</div>
<div class="col-sm-4" style="width: 100%; margin: 0 auto; padding: 10px; margin-top: 50px;">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div id="draggable1" class="ui-widget-content draggable">
<asp:Label ID="LabelName" runat="server" Text="Name"></asp:Label>
</div>
<div id="draggable1" class="ui-widget-content draggable">
<asp:Label ID="LabelDate" runat="server" Text="Date"></asp:Label></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="input-group">
<asp:DropDownList ID="FontSize" runat="server" CssClass="form-control" onchange="ChangeSize(this.value)">
<asp:ListItem Value="">Size</asp:ListItem>
<asp:ListItem Value="10px">10</asp:ListItem>
<asp:ListItem Value="20px">20</asp:ListItem>
<asp:ListItem Value="30px">30</asp:ListItem>
</asp:DropDownList>
</div>
<button id="clear">Clear localStorage</button>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</form>
</body>
</html>
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Image1"] != null)
{
Image1.ImageUrl= "~/Files/" + Session["Image1"].ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Server.Transfer("WebForm2.aspx");
}
protected void UploadFile(object sender, EventArgs e)
{
string folderPath = Server.MapPath("~/Files/");
//Check whether Directory (Folder) exists.
if (!Directory.Exists(folderPath))
{
//If Directory (Folder) does not exists Create it.
Directory.CreateDirectory(folderPath);
}
//Save the File to the Directory (Folder).
FileUpload1.SaveAs(folderPath + Path.GetFileName(FileUpload1.FileName));
//Display the Picture in Image control.
Image1.ImageUrl = "~/Files/" + Path.GetFileName(FileUpload1.FileName);
Session["Image1"] = Path.GetFileName(FileUpload1.FileName);
}
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.