On my aspx page I have two buttons. One calls some javascript and the other calls a C# function on the code-page. When I call the javascript file in the head of the document, the JavaScript function works well but the C# does not. Clicking on the button does not do anything. If I remove the javascript call then the C# function works normally.
How can I overcome this? It seems as if it is expecting to find the C# function within the JavaScript file.
ASP:
<head>
<script src="MyFunctions.js" language="javascript" type="text/javascript"></script>
</head>
<body>
<asp:Button id="btn1" Text="Submit" runat="server" OnClick="buttonSumbit_Click" />
<asp:Button id="btn2" Text="Show" runat="server" OnClientClick="buttonShow_Click()" />
</body>
C#:
protected void buttonSumbit_Click(object sender, EventArgs e)
{
//SOME CODE HERE
}
JavaScript:
function buttonShow_Click()
{
//SOME CODE HERE
}
languageattribute ofscriptelements has been deprecated long ago.