Click here to Skip to main content
15,884,099 members
Articles / Web Development / IIS

Customary Functions of GridView in ASP.NET 3.5

Rate me:
Please Sign up or sign in to vote.
4.55/5 (33 votes)
25 Mar 2009CPOL 93.4K   2.6K   69  
The most advanced things which you can do with GridView in ASP.NET 3.5
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//                          The Common Usage For GridView (Version 7.0)
//                                    Author: Behrouz Rad
//                         Copyright © 2006 - 2009, All rights reserved.
//                        feel free to contact me: behrouz.rad@gmail.com
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

namespace BehooGridViewFunctions.BLL.Orders
{
    using System.Collections.Generic;
    using BehooGridViewFunctions.DAL;
    using BehooGridViewFunctions.Entities;

    public class ChildPiece : BaseOrder
    {
        #region Constructor

        ///////////////////////////////////////////////////
        // Constructor
        ///////////////////////////////////////////////////

        public ChildPiece(int id, int privateId, string subPieceName)
        {
            this.ID = id;
            this.PrivateID = privateId;
            this.SubPieceName = subPieceName;
        }
        #endregion

        #region Properties

        ///////////////////////////////////////////////////
        // Properties
        ///////////////////////////////////////////////////

        public int ID { get; set; }
        public int PrivateID { get; set; }
        public string SubPieceName { get; set; }

        #endregion

        #region Public Static Methods

        ///////////////////////////////////////////////////
        // Public Static Methods
        ///////////////////////////////////////////////////

        public static List<ChildPiece> GetChildPieces(int parentId)
        {
            List<EntityChildPiece> childPieces = SiteProvider.Orders.GetChildPieces(parentId);
            List<ChildPiece> childPieceList = GetChildPieceListFromEntityChildPieceList(childPieces);

            return childPieceList;
        }

        #endregion

        #region Private Static Methods

        ///////////////////////////////////////////////////
        // Private static Methods
        ///////////////////////////////////////////////////

        private static ChildPiece GetChildPieceFromEntityChildPiece(EntityChildPiece childPiece)
        {
            if (childPiece == null)
            {
                return null;
            }
            else
            {
                return new ChildPiece(childPiece.ID, childPiece.PrivateID, childPiece.SubPieceName);
            }
        }

        private static List<ChildPiece> GetChildPieceListFromEntityChildPieceList(List<EntityChildPiece> childPieceList)
        {
            List<ChildPiece> childPieces = new List<ChildPiece>();
            foreach (EntityChildPiece childPiece in childPieceList)
            {
                childPieces.Add(GetChildPieceFromEntityChildPiece(childPiece));
            }

            return childPieces;
        }

        #endregion

        #region Public Instance Methods

        ///////////////////////////////////////////////////
        // Public Instance Methods
        ///////////////////////////////////////////////////

        public override string ToString()
        {
            return this.ID + "," + this.SubPieceName + "," + this.PrivateID;
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions