473,766 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Partial class problem

I have two web pages in a VS 2005 project. the first page has a struct
defined and used in the partial class:

public partial class InterIndex : System.Web.UI.P age
{
public struct TXMLData
{
public int DataID;
public string FileName;
public string FilePath;
public string Category;
public string DestLinkText;
public string DestIcon;
}
..........

in the second web page I want to use this same structure; it has code like
this:

public partial class InterIndex : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{
....
for (int i = d;i>=0;i--)
{
TXMLData nData= (TXMLData)NewsD ata[i];
UpdatesLinksLab el.Text+=nData. FileName+" - ";
}
........

}
}

the files have the same partial class (InterIndex) but the second page gives
me errors on missing namespace or directive for the TXMLData structure. if
they share the partial class why can't the structure definition be seen?
thanks
Phil barber

Sep 7 '07 #1
4 1985
On Sep 7, 1:45 pm, "Phil Barber" <pbarb...@houst on.rr.comwrote:
I have two web pages in a VS 2005 project. the first page has a struct
defined and used in the partial class:
<snip>
the files have the same partial class (InterIndex) but the second page gives
me errors on missing namespace or directive for the TXMLData structure. if
they share the partial class why can't the structure definition be seen?
Are they *actually* the same partial class, or are they in different
namespaces? It sounds very odd to create two partial files for the
same partial class for two pages: don't you need Page_Load in the
first page, for instance?

Jon

Sep 7 '07 #2
Hi,

"Phil Barber" <pb******@houst on.rr.comwrote in message
news:eo******** ******@TK2MSFTN GP02.phx.gbl...
>I have two web pages in a VS 2005 project. the first page has a struct
defined and used in the partial class:
the files have the same partial class (InterIndex) but the second page
gives me errors on missing namespace or directive for the TXMLData
structure. if they share the partial class why can't the structure
definition be seen?
thanks
Phil barber
Is this a web app or a website?

Are both "pieces" in the same folder?

website has some weird logic regarding namespaces and where you can put your
stuff.
Sep 7 '07 #3
Hi,
the files have the same partial class (InterIndex) but the second page
gives me errors on missing namespace or directive for the TXMLData
structure. if they share the partial class why can't the structure
definition be seen?
thanks
Phil barber
Sorry for posting again, do this, define a method in both pieces, if they
are correctly treated as the same class you will get an error, if not error
is displayed then you know where the problem is
Sep 7 '07 #4
I found the problem the files were in different folders
thanks
phil

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:Oe******** ******@TK2MSFTN GP04.phx.gbl...
Hi,
>the files have the same partial class (InterIndex) but the second page
gives me errors on missing namespace or directive for the TXMLData

Sep 7 '07 #5

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

Similar topics

8
7689
by: Agent Mulder | last post by:
Hi group, I have a problem with partial template specialization. In the code below I have a template struct Music with one method, play(), and three kinds of music, Jazz, Funk and Bach. When I specialize Music<Bach>, I expect that the original play() method is available in the specialization, but it is not. How can I fix this? -X
7
2131
by: Lionel B | last post by:
Greetings. The following code compiles ok and does what I'd expect it to do: ---------- START CODE ---------- // test.cpp
9
2531
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. I.e. do we have to need to write:
16
2652
by: pawel.pabich | last post by:
Hajo, I would like to have 2 my own partial classes. For example: Default.aspx.cs Default2.aspx.cs and they both will relate to Default.aspx page.
10
2445
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and load as a 3rd partial class. This would be handy so i can generate standard code into one of the partial classes, while having my custom code untouched
9
5789
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Data_List(); } }
3
2577
by: Lau Lei Cheong | last post by:
A few quick questions: Is there a limitation on how much partial class files we can have for a single class? And can a ASP.NET page file inherit a class from multiple code-behind files? if so, do I need to point out all the codefiles in the page directive, or just one of them is enough?
2
5566
by: Joseph Geretz | last post by:
When I create a Form, the VB IDE creates the following files in the following hierarchy: Form1.cs Form1.Designer.cs Form1.resx Both Form1.cs and Form1.Designer.cs are partial implementations of a single physical class definition. The VB IDE properly recognizes Form1.cs as a Form (i.e. double-clicking opens the Form designer). It also recognizes
1
1257
by: Zach | last post by:
I was reading about partial methods in the upcoming C# 3.0 with a friends and we were having a discussion about their usefulness. One on hand, they seem to be ok at providing a solution for allowing a class to be extended at compile time by users of the class, and as pointed out in some articles and papers they are good at acting as lightweight event handlers. On the other hand, they are in my eyes exactly almost a strict subset of...
0
9571
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9838
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.