I'm attempting to call a javascript method in its own file from code behind on a button click.
aspx file
protected void Next_Click(object sender, EventArgs e)
{
if (hidden.Value == "")
{
Response.Write(@"<script language='javascript'>drawImage();</script>");
}
}
js file
function drawImage() {
context.drawImage(video, 0, 0, 320, 240);
var imgBase = canvas.toDataURL('image/jpeg');
document.getElementById("hidden").value = imgBase;
}
The problem is that this wont call the draw image method, i suspect it's cause the js file is its own file but i'm not sure.
Any help you could give would be greatly appreciated.