ASP.NET
  Home arrow ASP.NET arrow Page 4 - Class Frameworks in VB .NET
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Class Frameworks in VB .NET
By: Eugene Gilerson
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 27
    2003-02-17

    Table of Contents:
  • Class Frameworks in VB .NET
  • Defining Data Access
  • Creating Business Objects
  • Presentation Layer
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Class Frameworks in VB .NET - Presentation Layer


    (Page 4 of 5 )

    Now that the business objects are built, we’re back to our presentation layer – the ASP.NET page. As you will see in a moment, the functions we need to perform on the page are now a breeze because all the logic has already been encapsulated into business and data access components.

    First of all, in the Page_Load event of editProduct.aspx page, we will create a new Product object:

    objProduct = New Product(Request.Params("ProductID"))

    This one line of code initializes objProduct with all information we require for display on the page. Then all we need to do is set the Textbox and Label control values:

    txtProductName.Text = objProduct.Name
    txtNumUnits.Text = objProduct.NumUnits
    txtPrice.Text = Mid(String.Format("{0:c}",objProduct.Price), 2)
    lblSupplier.Text = objProduct.Supplier.Name + " (" + objProduct.Supplier.Country + ")"


    Notice the use of objProduct.Supplier.propertyName syntax, which very typical for object-oriented frameworks. This is possible because Supplier is exposed as a read-only property of Product class and the information is accurate because each product holds only related-by-ID Supplier object.

    When user enters all information and clicks “Update” button, all the code we need to update the database with latest data takes up exactly 4 lines:

    objProduct.Name = txtProductName.Text
    objProduct.NumUnits = txtNumUnits.Text
    objProduct.Price = txtPrice.Text
    objProduct.Save


    And there it is. The Save function of the Product object will propagate all changes made by users back to the database table automatically. Once the page has redirected back to product list, the users will see the information updated on their screen.

    More ASP.NET Articles
    More By Eugene Gilerson


       · Hi, before reading your article, I always wondered "why we need OOP technique in...
     

    ASP.NET ARTICLES

    - How Caching Means More Ca-ching, Part 2
    - How Caching Means More Ca-ching, Part 1
    - Reading a Delimited File Using ASP.Net and V...
    - What is .Net and Where is ASP.NET?
    - An Object Driven Interface with .Net
    - Create Your Own Guestbook In ASP.NET
    - HTTP File Download Without User Interaction ...
    - Dynamically Using Methods in ASP.NET
    - Changing the Page Size Interactively in a Da...
    - XML Serialization in ASP.NET
    - Using Objects in ASP.NET: Part 1/2
    - IE Web Controls in VB.NET
    - Class Frameworks in VB .NET
    - Cryptographic Objects in C#: Part 1
    - Sample Chapter: Pure ASP.Net







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT