0

I am new at vb .net and I want to know how to make website in it? like connect two papes or using header in different file and linking it together etc..

for some reason when I create a page than vb studio automatic adds a form tag and creates two files(aspx and aspx.vb files). I am not sure if I need aspx.vb when making websites.

header.aspx

since menu is always same in all pages. it would be good idea to put the code in different file and include when you need it.

<html> 
    <body> 
    <form...> 
        <div> 
            <% simple menu. %> 
            <a href="page1.aspx"> home </a> 
            <a href="page2.aspx"> page 2 </a> 
        </div> 
    </form> 
 </body> 
</html>

page1.aspx

this will be main or home page

<html> 
    <body> 
        <form...> 
            <div> 
            <!-- header fiel --> 
            <%          
                  Response.WriteFile ("header.aspx")
               %> 
            </div> 
        </form> 
   </body> 
</html>

page2.aspx

<html> 
    <body> 
        <form...> 
            <div> 
            <!-- header fiel --> 
            <%          
                  Response.WriteFile ("header.aspx")
               %> 
            </div> 
        </form> 
   </body> 
</html>

Edited by hwoarang69

2
Contributors
1
Reply
24
Views
2 Years
Discussion Span
Last Post by djjeavons
3

Hi

Looking at the code that you have posted and the use of aspx and aspx.vb suggests that this is a WebForms web application. There are predominately two types (Web Forms and MVC) in the .NET Web arena. Currently, it looks like you are taking the classic ASP approach (using <% Response.Write.... %> style) which I would thoroughly recommend against.

Instead, with WebForms, Microsoft took a completely different approach in that they created a more event driven approach to developing web applications with the reason being that it would be easier for desktop developers to adopt .NET as a web platform. For this reason, the usual approach to developing a web forms application is to have two files (aspx and aspx.vb - or aspx.cs if using C#) which are actually partial classes. The aspx file is the designer file and is where you would include all of your HTML markup and control declarations (such as a button or data grid). The aspx.vb is the code behind file where all of the code would reside that responds to events from the UI.

If you want to include common page elements, such as header, navigation and footer then you would use a master file that contains this markup and reference that in your designer files.

Having said all of the above, if you are new to web programming in .NET then I would recommend that instead of starting with Web Forms, look at MVC. MVC (Model View Controller) is a design pattern with the goals of creating applications that are testable and follow a configuration over convention approach to development. It also tries to ensure a good separation of concerns pattern (although that is up to the developer to enforce). The ASP.NET MVC site contains some great introductory material and tutorials that should have you up and running in no time.

Finally, whether you use Web Forms or MVC, I would recommend getting a good beginners book on the subject. Just diving in and trying to get something to work is very difficult as there are so many pieces to each that you really do need a good grounding in the subject to create something that is usable and scalable.

HTH

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.