I’ve been using PHP for years to build websites. Often I will use an include to bring in, say a navigation menu:
<?php include 'includes/nav.php'; ?>
I am much more of a novice when it comes to ASP.NET (C#). I am wondering what is the correct (and most efficient) way of doing the equivalent of a PHP include, in ASP.NET?
Probably the most analogous ASP.NET construct to PHP’s include, based on your example, is creating and referencing a user control. This allows you to predefine markup as well as any server-side functionality in an ASCX file, which you can use into your page.
You can also use a master page, as someone stated below, which flushes out your basic layout and lets you define content place holders, which other pages can implement and fill in the content. Master pages are a popular approach for defining page elements that are consistent across all pages, like your nav there (also things like headers, footers, common scripts, CSS, etc.).