May, 2006

  • Wriju's BLOG

    Web Application Projects in ASP.NET

    • 0 Comments

    Applies to:

                Visual Studio 2005

     

    Introduction: We the developer community who used to develop the ASP.NET 1.1 applications using Visual Studio 2000/2003 were little bit confused. I guess almost all of us spent countable hours in Visual Studio 2005 to find where is the ASP.NET 2.0 .proj file is or where is our .dll file? Then we studied that the architecture is being rewritten in .NET Framework 2.0. Because of this we have gone through with the blog warnings that we may have to rethink our architecture while planning to migrate from ASP.NET 1.1 to ASP.NET 2.0. But here we go the concept of Web Application Project in ASP.NET 2.0 is introduced and it comes with as an add-in for Visual Studio 2005. This is an alternative option for ASP.NET 2.0 apart from Web site project model which is there in Visual Studio 2005. There is a good article available in MSDN on how to implement this feature (link is given below).

     

    Purpose: Purpose of this added option is the feedback received by Microsoft and the migration issue while doing the migration from ASP.NET 1.1 to ASP.NET 2.0. The migration also creates multiple dlls because the pre-compilation (publishing) funda forces web site projects to do that.

     

    Prerequisite: There are two installations are required for this to appear in your PC.

    1. Download this update for Visual Studio 2005 and install Microsoft Visual Studio 2005 - Update to Support Web Application Projects
    2. Visual Studio 2005 add-in for web project support needs to be installed then Visual Studio 2005 Web Application Projects

     

    I am a bit tempted to share the screenshot taken from my PC after installation. When you choose File > New > Project then the window has got new option.

     

    I hope this is real cool feature and you will enjoy it.

     

    Reference: To know more about this feature please visit Introduction to Web Application Projects

  • Wriju's BLOG

    Generics : An easy way to bind the data in DataGridView

    • 22 Comments

    Applied to: Visual Studio 2005 [C#]

     

    Yes this is Generics. The concept which helps us to create collection easily and elegantly. Two steps to create the list is demonstrated here.

     

    Step 1:

     

    You have one object say for list of products which contains three properties Name, Quantity and Price.

     

    using System;

    using System.Collections.Generic;

    using System.Text;

     

    namespace MSDN_Generics

    {

        class Product

        {

        

            private int _Quantity;

     

            public int Quantity

            {

                get { return _Quantity; }

                set { _Quantity = value; }

            }

     

            private int _Price;

     

            public int Price

            {

                get { return _Price; }

                set { _Price = value; }

            }

     

            private string _Name;

     

            public string Name

            {

                get { return _Name; }

                set { _Name = value; }

            }

     

            /// <summary>

            /// Constructor to initialize the class

            /// </summary>

            /// <param name="sName"></param>

            /// <param name="iQty"></param>

            /// <param name="iPrice"></param>

            public Product(string sName, int iQty, int iPrice)

            {

                _Name = sName;

                _Quantity = iQty;

                _Price = iPrice;

            }

         

        }

    }

     

     

    Step 2: Create a List of this class to use it for DataGridView’s datasource.

     

                List<Product> myProds = new List<Product>();

     

                myProds.Add(new Product("Prod 1", 1, 1));

                myProds.Add(new Product("Prod 2", 2, 2));

                myProds.Add(new Product("Prod 3", 3, 3));

                myProds.Add(new Product("Prod 4", 4, 4));

                myProds.Add(new Product("Prod 5", 5, 5));

                myProds.Add(new Product("Prod 6", 6, 6));

                myProds.Add(new Product("Prod 7", 7, 7));

     

                dataGridView1.DataSource = myProds;

     

    You need a namespace reference to use this Generic listing System.Collections.Generic

     

Page 1 of 1 (2 items)