0

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.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
SiliVestige
  • 41
  • 1
  • 1
  • 5

2 Answers2

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:

  1. How to store an ASP.NET master page in a common library?
  2. 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.

Community
  • 1
  • 1
marto
  • 4,170
  • 1
  • 28
  • 39
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