Advertisement

03.12.2008 at 01:25PM PDT, ID: 23236600
[x]
Attachment Details

Quick function call from another namespace (c# / asp.net 2.0)

Asked by Epiktet in Visual Studio, C# Programming Language

Tags: ,

I have created a cs-file in the app_code folder which I understand makes the complier include the namespace into the project automatically.

However, when I need to call a function from within this namespace I have to specify its exact path every time like so:
myproject.app_code.dateclass.getTodaysDate() or else it returns a "does not exist in the current context"

How can I make the getTodaysDate function global without having to refer to the entire path every time?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
namespace myproject.app_code
{
    public class dateclass
    {
        public static string getTodaysDate()
        {
            (some code....)
        }
    }
}
 
 
 
what I would like to be able to do in aspx file:
<% Response.Write(getTodaysDate()) %>
 
Loading Advertisement...
 
[+][-]03.12.2008 at 01:34PM PDT, ID: 21110453

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.12.2008 at 01:52PM PDT, ID: 21110630

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.12.2008 at 01:55PM PDT, ID: 21110679

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.12.2008 at 02:21PM PDT, ID: 21110897

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio, C# Programming Language
Tags: Microsoft, ASP.NET
Sign Up Now!
Solution Provided By: PockyMaster
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628