p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 4 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=560)
-   -   A namespace cannot directly contain members such as fields (http://p2p.wrox.com/showthread.php?t=80881)

SP2010Dude September 11th, 2010 04:09 PM

A namespace cannot directly contain members such as fields
 
I have this error message when I make the skin in page 234,
"A namespace cannot directly contain members such as fields or methods", seems like IntelliSense doesn't recognize the code which is
Code:

<asp:Button CssClass=”MyButton” BackColor=”#7a70a4” runat=”server” />
although I made the configuration to be able to use intellisense but it doesn't recognize the <asp tag

Imar September 12th, 2010 03:32 AM

Hi there,

What's the extension of the file that contains this code? And what editor did you hook it up to?

Normally, you get this error for code files (like .cs or .vb) when they contain invalid code so my guess is that VWD tries to interpret this as code, not as markup somehow....

Imar

SP2010Dude September 12th, 2010 03:39 AM

Reply
 
I added a skin folder to the Monochrome in the theme folder so it's now like :

-App_Themes
-Monochrome

SP2010Dude September 12th, 2010 03:44 AM

Reply
 
I added a skin folder to the Monochrome in the theme folder so it's now like :

-App_Themes
-Monochrome
-Skins
-Button.skin
and i went to Tools>>Options>>Text Editor>>File Extension and added skin in the Extension field and chose Microsoft visual c# in the editor drop down list.

but still I have a red line below the < in the beginning of the <asp:button tag.

I have also another question, how will the buttons capture this skin? where did we identify a class called .mybutton? when we added new button, it doesn't have this class by default for sure and I didn't notice we added this class to it, so how did it turned into purple?

Thanks a lot.

Imar September 12th, 2010 03:50 AM

Quote:

I added a skin folder to the Monochrome in the theme folder so it's now like :
Take a look at page 233, directly under the heading Creating a Skin File. You can't save them to sub folders.

Quote:

and chose Microsoft visual c# in the editor drop
Ah, that explains the error. But why would you want to do that? It's not C# code, it's markup. Take a look at page 234 for the proper instructions on how to do this.

Quote:

I have also another question, how will the buttons capture this skin?
It works the other way around. .NET sees the skin, and applies the CssClass on the skin button to the button in the HTML. Take a look at page 235 for an explanation.

Hope this helps,

Imar


All times are GMT -4. The time now is 09:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.