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.Sleep(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.Format("<script language='javascript' type='text/javascript'>setProgress({0},'{1}'); </script>", strPercent, strMessage));
                Response.Flush();

            }

        }..

the error :
CS0103: The name 'Notify' does not exist in the current context
LVL 1
doramail05Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale BurrellDirectorCommented:
It sounds like you haven't got this line at the top of your page:
<%@ Page Language="C#" Inherits="LoadingNotifier" Theme="Default" %>

Open in new window

0
guru_samiCommented:
since you have your LoadingNotifier class inside of a namespace you will need to adjust Inhertis like:
Inherits="loader01.LoadingNotifier" ...
if that is not the case ...can we see the @Page part of your code...
0
doramail05Author Commented:
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._Default" %>

default.aspx.cs
------------------
namespace loader01
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

doramail05Author Commented:
substitute with Inherits="loader01.LoadingNotifier".

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\787d4bb5\App_Code.gjzs0rnj.DLL' or from assembly 'C:\Documents and Settings\..\My Documents\Visual Studio 2008\Projects\loader01\loader01\bin\loader01.DLL'. Please specify the assembly explicitly in the type name.
0
guru_samiCommented:
Do this...
1: Modify your @Page attribute like this:
<%@ Page Language="C#"  CodeFile="Default.aspx.cs" Inherits="LoadingNotifier" %>

2: Modify your default.aspx.cs file like this:
------------------
    public partial class LoadingNotifier : System.Web.UI.Page
    {
        // move everything  inside the main LoadingNotifier class in App_Code folder here      
    }

3: Delete the LoadingNotifier.cs from App_Code folder

Note: Ideally your LodingNotifier.cs should be the class inside default.aspx.cs
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
doramail05Author Commented:
ok. changed to:

<%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="loader1.LoadingNotifier" %>

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();

            }

        }

    }
}

Open in new window

0
guru_samiCommented:
namespace is loader01 ...but inherits has loader1
so modify to:
 Inherits="loader01.LoadingNotifier"
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.