doramail05
asked on
using methods from App_Code
i try to follow the article :
http://www.codeproject.com/KB/aspnet/ASPNETAJAXPageLoader.aspx
to create an ajax page load,
inside the code, while using
<%
// We have achieved a milestone. Let the user know!
Notify("30", "Loading Departure Calendar Completed ...");
// Simulate Internet dalay
System.Threading.Thread.Sl eep(2000);
%>
from App_Code (LoadingNotifier.cs)
-------------------------- ---------- -------
namespace loader01
{
public class LoadingNotifier : System.Web.UI.Page
{
public void Notify(string strPercent, string strMessage)
{
// Only do this on the first call to the page
if ((!IsCallback) && (!IsPostBack))
{
//Update the Progress bar
Response.Write(string.Form at("<scrip t language='javascript' type='text/javascript'>set Progress({ 0},'{1}'); </script>", strPercent, strMessage));
Response.Flush();
}
}..
the error :
CS0103: The name 'Notify' does not exist in the current context
http://www.codeproject.com/KB/aspnet/ASPNETAJAXPageLoader.aspx
to create an ajax page load,
inside the code, while using
<%
// We have achieved a milestone. Let the user know!
Notify("30", "Loading Departure Calendar Completed ...");
// Simulate Internet dalay
System.Threading.Thread.Sl
%>
from App_Code (LoadingNotifier.cs)
--------------------------
namespace loader01
{
public class LoadingNotifier : System.Web.UI.Page
{
public void Notify(string strPercent, string strMessage)
{
// Only do this on the first call to the page
if ((!IsCallback) && (!IsPostBack))
{
//Update the Progress bar
Response.Write(string.Form
Response.Flush();
}
}..
the error :
CS0103: The name 'Notify' does not exist in the current context
since you have your LoadingNotifier class inside of a namespace you will need to adjust Inhertis like:
Inherits="loader01.Loading Notifier" ...
if that is not the case ...can we see the @Page part of your code...
Inherits="loader01.Loading
if that is not the case ...can we see the @Page part of your code...
ASKER
i try to put <pages theme="Default"> but has error, so i temporary removed theme.
then originally Inherits was="LoadingNotifier" as it was ambiguous, so i replaced with loader01._Default for default.aspx.cs
<%@ Page Language="C#" Inherits="loader01._Defaul t" %>
default.aspx.cs
------------------
namespace loader01
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
then originally Inherits was="LoadingNotifier" as it was ambiguous, so i replaced with loader01._Default for default.aspx.cs
<%@ Page Language="C#" Inherits="loader01._Defaul
default.aspx.cs
------------------
namespace loader01
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
ASKER
substitute with Inherits="loader01.Loading Notifier".
had this error:
The type 'loader01.LoadingNotifier' is ambiguous: it could come from assembly 'c:\WINDOWS\Microsoft.NET\ Framework\ v2.0.50727 \Temporary ASP.NET Files\root\bdd130a6\787d4b b5\App_Cod e.gjzs0rnj .DLL' or from assembly 'C:\Documents and Settings\..\My Documents\Visual Studio 2008\Projects\loader01\loa der01\bin\ loader01.D LL'. Please specify the assembly explicitly in the type name.
had this error:
The type 'loader01.LoadingNotifier'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok. changed to:
<%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="loader1.LoadingN otifier" %>
had this error :
ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
<%@ Page Language="C#" CodeFile="Default.aspx.cs"
had this error :
ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
namespace loader01
{
public partial class LoadingNotifier : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void initNotify(string StrSplash)
{
// Only do this on the first call to the page
if ((!IsCallback) && (!IsPostBack))
{
//Register loadingNotifier.js for showing the Progress Bar
Response.Write(string.Format(@"<script type='text/javascript' src='scripts/loadingNotifier.js'></script>
<script language='javascript' type='text/javascript'>
initLoader('{0}');
</script>", StrSplash));
// Send it to the client
Response.Flush();
}
}
public void Notify(string strPercent, string strMessage)
{
// Only do this on the first call to the page
if ((!IsCallback) && (!IsPostBack))
{
//Update the Progress bar
Response.Write(string.Format("<script language='javascript' type='text/javascript'>setProgress({0},'{1}'); </script>", strPercent, strMessage));
Response.Flush();
}
}
}
}
namespace is loader01 ...but inherits has loader1
so modify to:
Inherits="loader01.Loading Notifier"
so modify to:
Inherits="loader01.Loading
Open in new window