Board logo

subject: GridView and DetailsView controls used in the UI of ERP Software [print this page]


Controls used in Creating UI of ERP Software

The ERP software development process begins with identifying the modules to be created for the ERP Software. Let us list the five modules - Manufacturing, Sales, Purchase, Stock, and Accounting as the modules required for the ERP software.

For each module, a separate UI, Business Layer, Data Layer, and Reports are to be created. Creating applications as layers is recommended by Microsoft and is suitable for today's applications which are deployed on the local network and on the web simultaneously. To begin with knowledge of using Visual Studio and SQL Server is essential. Particularly, a programmer should know client server networking, network protocols, topologies, ip addresses, dns server, dhcp server, Creating a Logins, and dedicated Service Security Account.

There are many benefits of creating an application based on Multi-tier Architecture. Flexibility of deployment on the web is achieved and resource sharing is facilitated. With each layer having a specific purpose, changes implemented in one layer will not necessitate changes in other layers. This results in easier maintenance of the software.

Controls used in an ERP software to display data and accept data from users. GridView and DetailsView controls are two important controls.

GridView

The GridView control is a commonly used control in ASP.Net ERP applications. It is feature rich and a versatile databound control. The GridView control displays data in a spreadsheet format and also allows for editing, deleting, and saving of this data. While programming the UI, the datasource control is attached to the GridView control. The property DataSourceID of the GridView control is used to attach the DataSource control to the GridView control. This control allows paging, sorting and database operations with the database.

The SqlDataSource control contains ConnectionString, SelectCommand, UpdateCommand and DeleteCommand properties. The ConnectionString property connects the DataSource control to the database and properties SelectCommand, InsertCommand, UpdateCommand, DeleteCommand contains SQL statements that are executed when we display, insert and delete records with the GridView control. For inserting records, either the DetailsView control or the FormView control has to be used with the GridView control. In an ERP application, to insert records we use the GridView control's FooterTemplate. A GridView control and a SqlDataSource control are placed on a web form. The Select, Delete, Insert and Update commands are used to interact with the Sql Server database. The SqlDataSource control establishes a connection with the Sql Server database, retrieves data and passes the data to the GridView control.

The GridView control is the successor to the DataGrid control. The GridView control displays database records in a HTML table with each record in a table row and each field in a column. Paging and sorting records can be done in the GridView Control by setting following two properties.

AllowPaging = True'

AllowSorting = True'

To create a GridView control, drag the control from the Toolbox and place it on a web form. At this stage, there are no records in the GridView control.

By default, the AutoGenerateColumns property is set to true', which renders each field in the data source as a column in the GridView control. We can define which column fields appear in the GridView control by setting the AutoGenerateColumns property to false'. We can also define the column field collection. There are seven field types we can use to create columns in the GridView control. And they are:

1. BoundField

2. CheckBoxField

3. ButtonField

4. CommandField

5. HyperlinkField

6. ImageField and

7. TemplateField

DetailsView and FormView control

The DetailsView and FormView controls are used to display a single data item at a time. Both controls allow us to display, edit, insert and deletion of data items such as database records. Both controls support page forward and backward traversing. The difference between the two controls is the way the user interface is rendered. The FormView control uses a template to display a single database record at a time and the DetailsView control displays a single database record as HTML table. The DetailsView control is typically used for updating and inserting new records often in a master/detail scenario. In such a scenario, the selected record of the master control (GridView or ListBox control) determines the record to be displayed in the DetailsView control. For instance, in an ERP software application, we use the GridView control to display pending sales order details and the DetailsView control to display the selected single order details. By default, the DetailsView control displays each field (i.e., a database field) in a separate HTML table row. The DetailsView control supports both declarative and programmatic data binding. Using element with the DetailsView control, we can define individual fields to be displayed by the control. The element is similar to the element of the GridView control. The DetailsView control supports the same fields as the GridView control.

Using style elements in a DetailsView control

We can customize the DetailsView control appearance using the following style properties such as, HeaderStyle - Style used for header row, RowStyle - Style used to display rows, CommandRowStyle - Style used to display row that contains edit buttons and many more such properties.

Creating a DetailsView control

To create a DetailsView control, drag the control from the Toolbox and place it on the web form. At this stage there are no data items in the DetailsView control. To display data in the DetailsView control, we need to bind the control to a data source control. The DetailsView control provides two options for binding to data. Data binding using the DataSourceID property allows us to bind the DetailsView control to a data source control. In this approach, the DetailsView control takes advantage of the features of the data source control and provides functionality for updating and paging. The DetailsView control supports two-way data binding. Data binding using the DataSource property allows us to bind DetailsView control to various ADO.Net objects, datasets and datareaders. In this approach, we write code for functionalities such as updating and paging.

The event model of the DetailsView control is similar to that of the GridView control. The DetailsView control does not support a selection event. The current record displayed in DetailsView control is always the selected item in the master control. The DetailsView control raises events when the current record is displayed or changed. Events are also raised when a button control of the DetailsView control has been clicked.

Stored Procedures are written for handling all validations, updates and deletion. In summary, stored procedures for most of the data handling functions. However, some validations are written at the form level (UI) to minimize the return trips from the app to the server.

This is a brief of the few important controls used in database applications.

Based on the book titled :

Develop Web ERP Software using ASP.Net 3.5, C# & SQL Server

GridView and DetailsView controls used in the UI of ERP Software

By: Madhav




welcome to loan (http://www.yloan.com/) Powered by Discuz! 5.5.0