Note that there are some explanatory texts on larger screens.

plurals
  1. POcalling javascript/jquery function in asp.net
    text
    copied!<p>I have aspx page in which i use updatepanel</p> <p>some function i placed at the middle of page than on button client click i can't call them.</p> <p>code like this does not work </p> <p><strong>case 1:</strong></p> <p></p> <pre><code>&lt;%--some html--%&gt; &lt;asp:Button ID="btnBotton" runat="server" OnClientClick="return callfunction();" Text="Submit"/&gt; &lt;asp:UpdatePanel runat="server"&gt; &lt;ContentTemplate&gt; &lt;%--some content here--%&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;%--async trigger --%&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;script type="text/javascript"&gt; function callfunction() {//function placed at the middle of page alert('hello'); } &lt;/script&gt; &lt;%--some html again--%&gt; &lt;/asp:Content&gt; </code></pre> <p>and if i place my function at the end of page than i call function</p> <p><strong>case 2:</strong></p> <pre><code>&lt;asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;%--some html--%&gt; &lt;asp:Button ID="Button1" runat="server" OnClientClick="return callfunction();" Text="Submit"/&gt; &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;%--some content here--%&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;%--async trigger --%&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;%--some html again--%&gt; &lt;script type="text/javascript"&gt; function callfunction() {//function placed at the middle of page alert('hello'); } &lt;/script&gt; &lt;/asp:Content&gt; </code></pre> <p><strong>so I want to know what is the issue with case 1? Why i am not able to call function</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload