Note that there are some explanatory texts on larger screens.

plurals
  1. PONot able to run javascript in content page while using Masterpage
    text
    copied!<p><strong>I am not able to run progressbar code in asp.net on button click,while using contentpage/masterpage.<br> I have checked code without masterpage it'sworking cool..but getting problem while using masterpage. What is the problem i am not able to figure out??</strong></p> <pre><code> &lt;%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="UploadStudentDB.aspx.cs" Inherits="Admin_UploadStudentDB" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="Contentplaceholder2" Runat="Server"&gt; &lt;script language="javascript" type="text/javascript"&gt; var size = 2; var id = 0; function ProgressBar() { if (document.getElementById('&lt;%=txtFilePath.ClientID %&gt;').value != "") { document.getElementById("divProgress").style.display = "block"; document.getElementById("divUpload").style.display = "block"; id = setInterval("progress()", 20); return true; } else { alert("Select a file to upload"); return false; } } function progress() { size = size + 1; if (size &gt; 299) { clearTimeout(id); } document.getElementById("divProgress").style.width = size + "pt"; document.getElementById("&lt;%=lblPercentage.ClientID %&gt;"). firstChild.data = parseInt(size / 3) + "%"; } &lt;/script&gt; &lt;body&gt; &lt;div id="divUpload" style="display:none"&gt; &lt;div style="width:300pt;text-align:center;"&gt;Uploading...&lt;/div&gt; &lt;div style="width:300pt;height:20px; border:solid 1pt gray"&gt; &lt;div id="divProgress" runat="server" style="width: 1pt; height: 20px; background-color:Gray;display:none"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div style="width:300pt;text-align:center;"&gt; &lt;asp:Label ID="lblPercentage" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/div&gt; &lt;/div&gt; &lt;div align="center"&gt; &lt;table style="width: 100%; background-color:Silver" border="1"&gt; &lt;tbody align="center"&gt; &lt;tr&gt; &lt;td align="center"&gt; &lt;asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Size="XX-Large" Text="Please Select Excel File Containg Student Details..." ForeColor="White" Font-Underline="True"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div style="background: url(hline.gif) repeat-x bottom #F2F2F2;padding: 8px 5px;border-bottom: 1px solid #ccc;"&gt; &lt;asp:FileUpload ID="txtFilePath" runat="server"&gt;&lt;/asp:FileUpload&gt;&amp;nbsp;&amp;nbsp; &lt;asp:Button ID="btnUpload" runat="server" Text="Upload" OnClientClick="return ProgressBar();" onclick="btnUpload_Click" /&gt; &lt;br /&gt; &lt;asp:Label ID="lblMessage" runat="server" Visible="False" Font-Bold="True" ForeColor="#009933" Font-Size="Large"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;table&gt; &lt;/div&gt; </code></pre> <p></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