I have an HTML page and an .aspx page in my project. I defined a javascript function in the html page and trying to call it from code behind of the .aspx page
I tried using ClientScript.RegisterStartupScript() and ScriptManager.RegisterStartupScript() as following.
HTML page - MainPage.html
<script type="text/javascript">
$(document).ready(function () {
function functionName() {
#content
};
});
</script>
.aspx page - form.aspx.cs
Try 1
protected void Button2_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, GetType(), "MainPage.html", "functionName();", true);
}
Try 2
protected void Button2_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:functionName(); ", true);
}
I am trying to call function functionName() from HTML page when Button2 from aspx page was clicked