473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

_REALLY_ simple namespace question...

Hello everyone,

I feel really dumb asking this, but I can't work it out. Searching
gives me nothing, I'm down to thinking it's a bug in Visual Studio 2005,
but of course it probably isn't...
I want to add a namespace to my aspx file. I do this:

using System;
namespace test
{

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}

}

.... but I'm told all sorts of page errors. If I remove the
namespace-thing, nothing.

How can I add a namespace to my code-behind?

Thanks a million in advance,
Morten

Jun 6 '07 #1
9 1033
Wouldn't you need to add the namespace to the designer page too - note the
"partial class" syntax. It's probably trying to have one part of the class
in the root namespace and the other in the test namespace.

- Paul.

"Morten Nørgaard" <mn****************@uni-c.dkwrote in message
news:f4**********@news.net.uni-c.dk...
Hello everyone,

I feel really dumb asking this, but I can't work it out. Searching gives
me nothing, I'm down to thinking it's a bug in Visual Studio 2005, but of
course it probably isn't...
I want to add a namespace to my aspx file. I do this:

using System;
namespace test
{

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}

}

... but I'm told all sorts of page errors. If I remove the
namespace-thing, nothing.

How can I add a namespace to my code-behind?

Thanks a million in advance,
Morten

Jun 6 '07 #2
"Morten Nørgaard" <mn****************@uni-c.dkwrote in message
news:f4**********@news.net.uni-c.dk...
... but I'm told all sorts of page errors.
Like what...?

There's no point telling a technical newsgroup that you get "all sorts of
page errors" if you don't actually say what those errors are...
--
http://www.markrae.net

Jun 6 '07 #3
Paul Hadfield skrev:
Wouldn't you need to add the namespace to the designer page too - note the
"partial class" syntax. It's probably trying to have one part of the class
in the root namespace and the other in the test namespace.
Hi Paul,

thanks for the suggestion, I can see where you're headed. But I tried
that approach and alas it didn't aide me along.

But thanks again,

Morten

>
- Paul.

"Morten Nørgaard" <mn****************@uni-c.dkwrote in message
news:f4**********@news.net.uni-c.dk...
>Hello everyone,

I feel really dumb asking this, but I can't work it out. Searching gives
me nothing, I'm down to thinking it's a bug in Visual Studio 2005, but of
course it probably isn't...
I want to add a namespace to my aspx file. I do this:

using System;
namespace test
{

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}

}

... but I'm told all sorts of page errors. If I remove the
namespace-thing, nothing.

How can I add a namespace to my code-behind?

Thanks a million in advance,
Morten

Jun 6 '07 #4
Mark Rae skrev:
"Morten Nørgaard" <mn****************@uni-c.dkwrote in message
news:f4**********@news.net.uni-c.dk...
>... but I'm told all sorts of page errors.

Like what...?

There's no point telling a technical newsgroup that you get "all sorts
of page errors" if you don't actually say what those errors are...


Mark,

touché. The reason I didn't give the error messages is in that my
VS.NET 2005 is a Danish version and I got stumped trying to translate
the Danish message into English ones. As far as I could tell they
weren't related to the error, giving me quite ridiculous possibles. But
if you'd care to invest the one minute it'd take you to create the page
in VS.NET yourselves, I'd be very grateful indeed. The code-behind is this:

using System;

namespace test
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
.... and the page looks like this:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title="fdsaf" /></head>
<body <form id="form1" runat="server"></form</body>
</html>
That's really all there is to it. But won't compile... :-(
/Morten
Jun 6 '07 #5
"Morten Nørgaard" <mn****************@uni-c.dkwrote in message
news:f4**********@news.net.uni-c.dk...
That's really all there is to it. But won't compile... :-(
Indeed not, because it's now looking for a class called _Default, which no
longer exists...

Change Inherits="_Default" to Inherits="test_Default"
--
http://www.markrae.net

Jun 6 '07 #6
Morten Nørgaard skrev:
Hello everyone,
How can I add a namespace to my code-behind?

I discovered the solution: to add the name of the code-behind namespace
to the 'inherits' attribute of the page, i.e.
"inherits='mynamespacename.mypagename'".

Paul, this was what you were trying to tell me, right? :-)

/Morten
Jun 6 '07 #7
Morten Nørgaard wrote:
Morten Nørgaard skrev:
>Hello everyone,
How can I add a namespace to my code-behind?


I discovered the solution: to add the name of the code-behind namespace
to the 'inherits' attribute of the page, i.e.
"inherits='mynamespacename.mypagename'".

Paul, this was what you were trying to tell me, right? :-)

/Morten
Yes, it was. :)

--
Göran Andersson
_____
http://www.guffa.com
Jun 6 '07 #8
"Morten Nørgaard" <mn****************@uni-c.dkwrote in message
news:f4**********@news.net.uni-c.dk...
I discovered the solution: to add the name of the code-behind namespace to
the 'inherits' attribute of the page, i.e.
"inherits='mynamespacename.mypagename'".
As I mentioned... :-)
--
http://www.markrae.net

Jun 6 '07 #9
Mark Rae skrev:
"Morten Nørgaard" <mn****************@uni-c.dkwrote in message
news:f4**********@news.net.uni-c.dk...
>I discovered the solution: to add the name of the code-behind
namespace to the 'inherits' attribute of the page, i.e.
"inherits='mynamespacename.mypagename'".

As I mentioned... :-)

Yup - thanks everyone :-)

Jun 6 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Keiron Waites | last post by:
Please see the problem in action here: http://www.leadbullet.biz/contact.php If you mouse over the fields, you will see that text is shown on the right. The text makes the other fields move when...
22
by: lokman | last post by:
Hi, In the following code, can someone tell me the difference between *p++ and p++ ? I can see both achieve the same result. Thanks a lot !
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
3
by: Katie S | last post by:
I have a method that takes a string, formats it and returns it I want to use this in multiple ASP.NET pages, by putting it in a namespace and using that in each asp.net page What I don't...
7
by: SL | last post by:
Could someone direct to a simple explanation of how to use MS Visual Studio 2003 to design .aspx code? This code works if pasted into notepad and run as an .aspx file: <%@ Import...
6
by: Paul | last post by:
Hi All, Framework 1.1 listbox control unable to DataBind I've been googling for an answer to this query that appears quite a lot, but none, it seem, answers my problem directly. I am...
3
by: Marco T. | last post by:
Hi all, why the former code fragment works and the latter doesn't? ============= //CORRECT CODE: namespace ciao { class A{};
3
by: Chrism2671 | last post by:
I'm new to XSLT/XML and I have a very simple, quick question. i've been trying to convert simple xml files into CSV files and have made a simple XSLT template using the w3 tutorials, but it doesn't...
4
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Am i missing somthing simple? I can't access any of the profile names in my code behind i.e; textBox1.text = Profile.test = "some text" here's the web.config: <?xml version="1.0"?> ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.