I'm working on a joint project and right now we are using a Master Page in VB. Problem that I'm running in to is I have no experience in coding with VB. I have been routinely coding in C#, C++, and others in this branch of syntax. Is it possible to have a Master Page in VB and then have a content page in c#? I'm not sure if it will directly inherit the language or not.
Asked
Active
Viewed 167 times
0
-
Not at the time I posted. I wanted to check before I wrote the code and caused any grief. – SiliVestige Jun 30 '11 at 16:47
2 Answers
2
You can mix C# and VB in the same project only if you are working with a Website project. If it's a web application you need to have a common library which will have your Masterpage Class which can be compiled in a different language.
Here are a few questions which you might find helpful:
- How to store an ASP.NET master page in a common library?
- Difference between 'Web Site' and 'Project' in Visual Studio
All said. My recommendation would be to take the hit and learn the VB syntax. I know it's very verbose and not pleasant but otherwise you'll have a mix of 2 languages in the project which will make it more difficult to maintain.
1
I don't see why you wouldn't be able to do this, after all the Page
declaration is only pointing to a .master
file and you define the language of the page in the header too.
<%@ Page Language="C#" MasterPageFile="MySite.Master" %>

Neil Knight
- 47,437
- 25
- 129
- 188
-
Thanks. Just wasn't sure that it was possible but I guess it's no different than a simple script. – SiliVestige Jun 28 '11 at 16:10