开发者

Master Page and Programming Languages

I'm wo开发者_JS百科rking 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.


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.


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" %>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜