Tag: asp.net

Adding a GridView control to an ASP.NET page is one of the simplest ways of displaying databound data. The GridView can be created simply by opening the Database Explorer and dragging the table or view that from which you want to display information. However, the default GridView which is automatically generated in this way almost always needs some tweaking. One typical change you may want to make is to change some of the BoundFields elements to TemplateFields elements.

The BoundField object displays data from a given column in the data source with no real modification. By contrast, any content you desire can be placed inside a TemplateField element. This makes it ideal for setting up validation through the use of validation controls.

TemplateFields offer great flexibility by allowing you to include a variety of templates to cater for the different states of the conditions arising within the GridView. There are several types of template which may be added inside a TemplateField object; the main ones are described below.

The HeaderTemplate offers a way of customizing the information which will be displayed in the header of the column in which the TemplateField is located.

The ItemTemplate is used to contain the information which you want displayed for each row of data when the GridView object is not selected for editing.

The EditItemTemplate is used to display the information which you want displayed for each row of data when the GridView object is in edit mode. It is here that you would place the controls necessary for validation.

In a typical scenario, you would display the information currently held in the database by adding a TextBox control inside the EditItemTemplate and databind it to the appropriate column from the data source using a statement like Bind(“FirstName”). Inside the same EditItemTemplate, you would then place the necessary validation control. For example, if you want to ensure that the field is not left blank when the form is submitted, you would insert a RequiredFieldValidator control.

The writer of this article is a developer and trainer with Macresource Computer Training, an independent computer training company offering ASP.NET training courses in London and throughout the UK.

Tags: , , , , , ,

Displaying information on a web page which comes from a database is a fairly standard requirement on most websites and, in some development environments, it can take a fair amount of programming to achieve. In ASP.NET, however, it is remarkably easy, thanks to the use of built-in data-bound controls. There are two types of data-bound controls: those which are designed to display multiple records and those which will display one record only. The GridView control, the workhorse of databinding in ASP.NET, falls into the first category. It automatically generates an HTML table and fills it with information from a given data source with each record in the database rendered as a row in the table.

When using Visual Web Developer the easiest way to create a GridView control is simply to explore the appropriate data source using the database explorer, then drag the appropriate table or view onto the page. This action creates both a DataSource object and a GridView object, both of which can be customised either in Design or Source view. If the listing you wish to display on the page is to be tabular, you may not need to change the default GridView. However, it is more usual that you will want to customize the way in which data is displayed.

The first step in customization is often to turn off the automatic display of all the fields in the database as columns in the HTML table. This is done by setting the GridView’s AutoGenerateColumns attribute to False. Secondly, we can display data in a number of different ways. By default information is displayed in a BoundField, meaning that the data is displayed as text. By default, the heading displayed at the top of each column is simply the name of each field in the database. However, you can modify this by changing the HeaderText property of each BoundField element. Another useful property is DataFormatString which allow you to use a format string to control the display of data.

Another useful form of customization is the display of data in a choice of other HTML formats: CheckboxField, RadioButtonField, HyperlinkField, ButtonField and ImageField. The final type of field is CommandField which enables you to display links enabling the user to edit, delete or select rows of data.

For even greater flexibility, the GridView control also provides the TemplateField which allows you to place any HTML content you like in a given column and use databinding statements to embed information from the database as required. Template fields can even contain ASP.NET server controls.

The writer of this article is a developer and trainer with Macresource Computer Training, an independent computer training company offering ASP.NET Classes in London and throughout the UK.

Tags: , , , , ,

For developing dynamic web pages you need to do yourself a favor and get Asp Dot Net training. This is server side technology at its most flexible and powerful. The basis of this technology is the Microsoft’s. NET Framework which consists of a large set of classes, specifically designed to suit all programming requirements. ASP. Net is only one of the components of this training.

Essentially this framework training was developed to solve certain fundamental problems that programmers often face. These include reliable time saving for the building of large applications; Allowing various languages to operate on these applications. A cheaper, faster and easier way to get the applications into the hands of the user, no complex codes with complicated languages are required, and programmers are also able to unify the architecture/applications to operate locally on a machine from web accessed applications.

In short you get impressive results with far less complex programming. This is very important when you are required to have many different programming languages, for example, C++ and visual basic. Often these languages overlap, and each of them require different methods for working with data bases, accessing file systems and manipulating strings.

The syntax for both C++ and Visual Basic is written differently but basically functions the same, and this is the case with the majority of programming languages. Variable data in respect of strings and integers is similar and. Net framework is designed to work with this and simplify matters.

The file system works with classes, as does generating graphics, access to data base, working with system files and manipulating text. Net Framework offers incredibly specialized training systems for working with expressions and the management of network protocols.

Your training will encompass all the core types of data such as bytes, integers, strings, characters and arrays, and the point of the ADP. Net Framework training is that you are able to access your classes, while you are in the process of building your pages.

This framework consists of more that three thousand five hundred classes which are structured into namespaces. You are taught to understand namespaces as this is integral to the success of your training. Namespaces are organized logically and grouped together, as jumbling them up would make it difficult to relate them to working with system files.

Bear in mind that ASP and ASP. Net are two different concepts as with ASP script is the only language used for web design, whereas ASP. Net allows for programming using a variety of computer languages.

Author is a developer and trainer with Macresource Computer Training, a UK IT training company offering ASP.NET training courses in London and throughout the UK.

Tags: , , , , , , ,
Back to top