Using Namespaces Once In The Master?
Jul 21, 2010I'm using nested master pages for my site, is there a way I can use the namespaces once in the master?Currently I have to add the namespaces to whichever page I need them in.
View 1 RepliesI'm using nested master pages for my site, is there a way I can use the namespaces once in the master?Currently I have to add the namespaces to whichever page I need them in.
View 1 RepliesI have a web site that was done in asp.net 2.0 along with visual studio 2005. I've recently upgraded to VS 2008 and I'm haveing an issue with the namespaces in the web.config file not registering. Specifically, references to system.web and microsoft.visualbasic.
View 3 RepliesI've recently switched over to using the Razor view engine, and I want to specify a namespace to use in a view. I've tried adding an entry to the Web.config file, ie:
[Code]....
But none of my views recognise any of the classes inside that namespace, so I have to declare the namespace in every view that needs it. why the Web.config approach isn't working?
what are the namespaces that should be well known by a fresher to initiate asp.net learning, what is the main use of a namespace. what is the use of 'args'
View 4 RepliesASP.NET MVC's MapRoute method has a parameter named namespaces. From looking in the code, I see that this parameter is saved in the Route object
in DataTokens["Namespaces"].
It seems to me that it has some meaning... anyone knows what is it for?
I read an article here to find the solution to my problem. But I found that it is not working for me. Whenever I tries to use any function I have to add same namespace on every page. by doing using System.Web.UI . Can I also use it for namespace that is being created along with an application. i.e. Library is an another namespace that lies in App_Code folder not as an assembly.
[code]......
Is there any way to get them available at Code Behind Page
I'm working on an ASP.NET webapp using the MVP pattern, and as I'm organizing my files I'm wondering - are there conventions on folders within projects and how they relate to namespaces?
I have a bunch of controls and a bunch of pages, and I was going to throw them into Controls and Pages folders with subfolders, but I didn't know if it was bad form to do this if I wasn't also going to seperate them out into namespaces.
im creating a class library, and adding all the necessary references for the source files contained in it.
Now, off the bat, there were over 300 compiler errors complaining about missing namespaces.
The library will now compile after i just added all of the System.* references, however this is obviously not the best way.
I.e. if a classes needs using System.Web.Script;, there is no System.Web.Script reference, how would i find out which one of these references contained it? System.Web didnt.
I need to add this namespace to my c# file:
using System.Data;
Is there a way to automatically add this to newly created pages in c#.net?
I don't want to add this namespace to new pages.
I am referencing some classes in my _layout.cshtml file and I have the namespaces in my Views/web.config <pages><namespaces> section and the layout page does not resolve. If I put @using statements in the layout page, it works fine. Shouldn't the layout page respect the web.config section?
View 5 RepliesI'm trying to understand the relationship between assemblies, namespaces and classes. Can anyone help explain or point me to a usefule link?
1. I understand that an assembly is typicall a dll or an exe (perhaps other files also). Does each project compilation produce only 1 dll? Or is the number of DLL dictated by something completely different?
2. I read each assembly can contain multiple classes. Asingle assembly can contain classes for multiple namespaces, and asingle namespace can span multiple assemblies.
See the page [URL].
Defining namespaces in web.config works fine with VB.NET, but C# is not recognizing the namespaces.
I have the following code:
[Code]....
I would like the functionality of namespaces inside of a class, as in something that would let me call Step2.Execute() instead of having to put Step2_ in front of a whole bunch of functions. I don't want to have to create separate classes / modules for step1, step2, etc.
Is there a way that I can accomplish namespace functionality from inside a class?
We have a large ASP.NET project which has 100s of BLL classes. In our ObjectDataSources in the UI layer we have typename="". Because we are converting to a web application project, the typename has to include the root namespace of the project. This means we have 1000s of changes to make across lots of files.Are there any better options out there to prevent us from having to do this?
View 1 RepliesI am using vs2008 vb code behind. I am currently receiving an object through a web service that I serialize into xml. What I'd like to do after that is remove the namespaces, and add nodes to sort of customize my own xml doc. I am getting an error on this
Code:
Dim DOC1 As New XmlDocument
Dim STR As String
STR = ConvertObjectToXmlString(HODRes).ToString
DOC1.LoadXml(STR)
[Code] ....
The error I get is:
Server Error in '/RateAudit' Application.
________________________________
Data at the root level is invalid. Line 1, position 1.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
Source Error:
Line 109: Dim STR As String
Line 110: STR = ConvertObjectToXmlString(HODRes).ToString
Line 111: DOC1.LoadXml(STR)
Line 112:
Line 113:
When i create a class file .vs add some default using statement like (using System;using System.Collections.Generic;) .But now i expect vs add using System.Configuration by default.
View 2 RepliesIf MVC application has multiple projects (The solution may grow large in future). These projects may share controllers such as application controller accouts controller and there may also be a situation in which namespace of one project is shared by other project. What is the best way of implementing such solution. One approach may be to use areas.
View 4 RepliesIs there any way to seperate development of different modules in a application other than using namespaces? I want to be able to define interfaces between the modules and unit test them seperately.
View 2 RepliesI am working on a web project in Visual Studio 2010 with ASP.NET 4.0/C# 4.0.My requirement is to remove all the namespace referenced from codebehind in C# and put it in web.config.
As per the link, [URL], from MSDN I added the namspaces to web.config.
Now my web.config will look like this.
[code]....
I keep getting the error: Error message: CS0101: The namespace '<global namespace>' already contains a definition for 'checkvalue'. Then, I rename the Inherits from the @page directive in both the .aspx and .aspx.cs pages and it works! My website has only 2 pages, and both use the same class (same class name, exactly same syntax) but it has been copied and pasted and the 2 aspx pages (and aspx.cs pages) are not referencing each other. In other words, both aspx.cs pages (called page1.aspx.cs and page2.aspx.cs) has the class
public class CheckValue
{
//content
return true;
}
Both the aspx pages reference the 'inherits' files seperately:
<%@ Page Language="C#" CodeFile="page1.aspx.cs" Inherits="_1" %>
and my code behind
public partial class _1 : System.Web.UI.Page
and for my second page
<%@ Page Language="C#" CodeFile="page2.aspx.cs" Inherits="_2" %>
and my code behind
public partial class _2 : System.Web.UI.Page
I don't use the .resx file. Why does this error happen some times, and not other times?
Is there anyway I can extend LINQ classes through different namespaces?Typically in my class libraries I have a namespace for each class object and their associated DAO and service classes in a folder of my project, therefore on the front-end I can only use the namespaces associated with the given page and not clutter my intellisense or load in a bunch of excess stuff.
However, I have found that upon adding my .dbml LINQtoSQL file, whatever namespace that is in, whether it's the project root namespace or a custom one, is the only namespace I can use partial class extension in.I have tried even creating a custom workspace (placing the .dbml file in a folder) and then including a using statement to that namespace and I still cannot extend the partial classes.Is there anyway I can do this? Or to have the .dbml file count as being in every namespace? I don't want to remove all namespaces but the root one either.such when I try doing the partial class from a different namespace I get the following error:
Error 1
'Id' is not a member of 'LCFVB.EntityNS.Entity'.
C:Usersshol726.UILAWDocumentsVisual Studio 2008ProjectsLCFVBEntityNSEntity.vb
10 7
LCFVB
I am not able to use the below namespaces in order to Run a powershell script:
using
System.Management.Automation;
using
System.Management.Automation.Runspaces;
I have installed Windows Powershell 2 and the framework is 2.0. I have added the referenece System.Management in the web.config file. Also i have browsed the above 2 namespaces and added to the project in add reference tab. Still i get the below message:
CS0234: The type or namespace name 'Automation' does not exist in the namespace 'System.Management' (are you missing an assembly reference?)
If I add a namespace element to the system.web pages namespaces section of the web.config do I still have to add references in the code behinds in order to have access to the members of that namespace at design-time?
View 1 RepliesI noticed when creating a reference that two of the columns in the dialog box under the .Net tab have Version and Runtime.
I'm assuming that Version is the version of the .Net Framework that a given namespace was introduced with.
I'm not sure I understand what the runtime is though. I originally thought it was for the version of ASP.net but now I question that. If look at two namespaces that were introduced with two different Versions they can have the same run time. This contradicts my original conclusion.
how these relate to each other and correct any misunderstandings I my have with this?
I have a page inside my folder ( say Admin Folder , Page1.aspx ) and I want to use the Master Page which is placed Outside the folder.
with Intellisense I am getting like this ~/Mymaster.master", but at run time it is throwing an error.