I have a file and form called:
File: output.aspx
<form action="output.aspx?d=png" method="post" id="download-chart-form">
<input type="hidden" id="download-chart-dataUrl" name="dataUrl" />
</form>
Then in that file I have Javascript/jQuery like so:
File output.aspx
// also have this but still not working
$(document).ready(function ()
{
$(function ()
{
var oldPostBack = __doPostBack;
__doPostBack = function ()
{
$("form").triggerHandler("submit");
oldPostBack.apply(this, arguments);
};
});
...
var img = new Image();
img.onload = function ()
{
ctxt.drawImage(this, 0, 0);
domURL.revokeObjectURL(url);
var dataUrl = d3Canvas.toDataURL();
$('#download-chart-dataUrl').val(dataUrl);
var downloadExcelForm = $('#download-chart-form');
downloadExcelForm.submit();
};
img.src = url;
I get the javascript with alerts to tell that the dataUrl and all the objects are created but can't get the form sent back to output.aspx.cs.
The code behind is:
public partial class output : PageBase
{
protected override void Page_Load(object sender, EventArgs e)
{
base.Page_Load(sender, e);
if (!IsPostBack)
{
string png = Request["d"] ?? string.Empty;
if (string.IsNullOrEmpty(d))
{
...