By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 881 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

stupid newbie question about class declaration

P: n/a
Hi. I am doing a tutorial

http://www.15seconds.com/Issue/020319.htm

About creating user controls in ASP.NET. As I run through the tutorial,
there is a point after which I create a lovely looking page with text boxes
and whanot that I go into code and change

public partial class UCLogin : System.Web.UI.UserControl

to

public abstract class UCLogin : System.Web.UI.UserControl

Actually I had deleted all teh code from the code behind file and replaced
it with the tutorial. Not until I messed around with this change did I
notice it was the cause of the build error...

"Missing partial modifier on declaration of type 'UCLogin'; another partial
declaration of this type exists."

My handy dandy help file tells me that a partial class is such:

"Partial type definitions allow for the definition of a class, struct, or
interface to be split into multiple files. "

I have no interest in separating the class into separate files. When I added
a new item in VS, this partial definition was there by default. I want to
change it to abstract as the tutorial tells me to do.

Can someone please help me understand this build error and how to correct it
without specifying a partial class which I don't want? Thanks!

I hope this is not an overly ignorant question.

Thanks.

Stephanie
Nov 19 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Tue, 18 Nov 2008 17:22:02 -0800, Stephanie <ha**@noway.netwrote:
[...]
I have no interest in separating the class into separate files. When I
added
a new item in VS, this partial definition was there by default. I want to
change it to abstract as the tutorial tells me to do.

Can someone please help me understand this build error and how to
correct it
without specifying a partial class which I don't want? Thanks!
When you added the UserControl sub-class UCLogin to your project, VS added
a special .cs containing the Designer-generated code for the class. You
should find it under the main item for your control in the Solution
Explorer (it should have the word "Designer" in the file name).

If you really want to start from scratch, you'll need to delete that file
from your project. Note that should you do so, you won't be able to
modify your UserControl sub-class using the Designer. But if you're
changing it to abstract, I don't think you'd be able to do that anyway, so
that shouldn't matter. :)

I've done very little ASP.NET so I didn't even bother to look closely at
the tutorial you're following. But it looks to me as though perhaps it
was written a while ago, before partial classes were supported (i.e. VS
2003 era). That may explain the disconnect between the tutorial and what
wound up happening in the IDE as you followed it.

Pete
Nov 19 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.