Software Articles

August 27, 2009

Using DataBound Controls In ASP.Net 3.5

Filed under: ASP.Net — Tags: , , , , — admin @ 10:32 am

Displaying data on a web page which is bound to information in a database is a very common requirement in web applications. In ASP.NET version 1, the main control for achieving this was the DataGrid. In the current release of ASP.NET, version 3.5, the DataGrid is conspicuously absent from the Toolbox in Visual Web Developer. In fact, although the DataGrid can still be used in ASP.NET pages and will work fine, it is now deprecated. The good news is that there is a good choice of more powerful new controls which have taken its place. Four of these controls (GridView, DataList, Repeater and List View) are suitable for displaying multiple records from a data source and then there are another two (FormView and DetailsView) which are used to display only one record at a time.

The GridView control is the workhorse of ASP.NET’s DataBound controls. It displays data items in an automatically-generated table and has a rich set of easily-configurable options.  Options include the ability to customize columns and to include custom content in columns such as images or any other relevant HTML column. Command columns can also be added containing links which will enable the user to edit and delete records. The control also supports paging and sorting.

The DataList control also automatically generates a table when it produces its output. However, unlike the GridView control, it allows the display of more than one record per row using its RepeatColumns property. The DataList is also template-driven, requiring the use of an ItemTemplate containing dynamic data. The elements placed inside the ItemTemplate are rendered once for each item in the bound data.

The Repeater Control also uses an ItemTemplate element to format its output. However, since it does not automatically generate a table, it offers considerable flexibility of layout. Output can be rendered as paragraphs, as a series of DIV elements, an ordered list, an unordered list or a customized table.

The ListView control, introduced with ASP.NET 3.5, also uses templates for displaying its output. However, it is far more sophisticated, allowing the use of a variety of templates, for example: a LayoutTemplate for specifying the overall container for the data; an ItemTemplate for specifying the rendering of each item of data; an ItemSeparator template, used to specify the content displayed between items of data; and so on. The ListView control also supports paging, sorting and editing records as well as the creation of new records.

Of the two controls used to display single items of data, the DetailsView resembles GridView in that it displays its output in an automatically-generated HTML table. The other single record data bound control, the FormView, resembles the ListView control, in that it is entirely template driven. Both of the single record controls support paging and sorting and allow you to edit and delete records as well as adding new ones.

Author’s company runs ASP.NET training courses in London and throughout the UK.

August 21, 2009

Using The Book Command In Adobe InDesign

Filed under: InDesign — Tags: , , , , , , — admin @ 6:11 am

When you choose New from the File menu in Adobe InDesign, you may have noticed the option to create a new book without ever knowing exactly what a book is. Well, in fact, books are a fairly nifty feature: they allow you to take a series of related InDesign document and treat them as a single entity; a book. All documents in the book can then share resources such as paragraph and character styles, colour swatches, master pages, sections and page numbering.

Having created a book, by choosing File-New-Book, the Book panel is displayed. It contains a panel menu with all the necessary options. The first task is to add documents to the book: from the Book panel menu, choose “Add Document” and select the documents you want to be treated as part of the book.

The book file can now be saved. The book is a separate entity to the documents it contains and the documents in a book do not have to reside in the same location as the book or as each other. To save the book, choose Save Book in the Book panel menu.

Next specify which of the documents in the book will be treated as the style source. The document elected as the style source will be used as the master document in the process known as synchronization whereby InDesign replaces the colour swatches and styles of all documents in the book with those in the style source document.

To control page numbering across the whole book, choose Book Page Numbering Options in the Book panel menu. The default behaviour is “Automatically Update Page & Section Numbers”: this will number pages in the documents within the book according to the order in which they are listed in the Book panel.

You can replace an existing chapter of a book with another InDesign document by simply selecting an existing book chapte and choosing Replace Document from the panel menu. Next, navigate to the replacement document and double-click to select it. InDesign will then replace the selected chapter with the new document. Deleting chapters from a book is equally straightforward. Just highlight the chapter(s) and choose Remove Document from the panel menu, or click the Remove Document icon at the bottom of the Book panel.

Books are a great tool for division of labour since the fact that a document is part of a book does not stop it from being a regular InDesign document. If a book contains five documents, five different people can work on each of those documents and then, at the end, the whole book can be preflighted, printed and output as PDF as a single unit.

Both tables of contents and indexes can also be generated for an entire book as well as for a single document. Simply create the table of contents or index in the normal way but activate the option “Include Book Documents”.

Adobe InDesign training courses in London and throughout the UK.

August 20, 2009

Creating CSS Styles In Adobe Dreamweaver CS4

Filed under: Computers — admin @ 7:11 pm

Cascading Styles Sheets (CSS) are a recommendation of the Worldwide Web Consortium (W3C) and offer web designers precise control over the formatting and layout of web pages. They enable you to set up default formatting rules which the browser will automatically apply to headings, paragraphs and any other elements on a web page. CSS allows web developers to separate the content of their web pages from the style and formatting information. This means that the HTML code is not cluttered with style information and will be processed more quickly by browsers, leading to faster download times. Also, since style definitions are normally stored in external files to which all HTML pages are linked, the entire site can be updated by modifying the CSS file(s), without even having to open any of the HTML pages.

CSS can be implemented in three different ways. Firstly, it can be placed inside an HTML document, in the HEAD area of the page. Secondly, CSS can be placed in an external file with a “.css” file extension. Thirdly, CSS can be placed inline; that is to say, inside HTML tags. The three methods are not mutually exclusive. A typical website may have one or more external style sheets, combined with internal CSS on certain pages and a few smatterings of inline CSS within certain HTML pages. In general, the closer the CSS is to the HTML element it controls, the higher its precedence. Thus inline styles normally take precedence over internal CSS, which, in turn, takes precedence over external CSS definitions.

To create internal CSS rules in Dreamweaver, simply open the HTML page then display the CSS Styles panel by choosing CSS Styles from the Window menu. Next, choose New from the CSS Styles panel menu. At the bottom of the New CSS Rule dialog, Dreamweaver invites you to “Choose where your rule will be defined”. Choose “This document only” from the drop down menu. If, instead, you choose “Create New Style Sheet”, the new CSS rule will be placed in an external file. (Dreamweaver will allow you to specify where the file is placed.) If you would like to link an existing CSS file to an HTML page, choose “Attach Style Sheet” from the CSS  Styles panel menu and click on the Browse button; locate the file then click “OK”.

Once a CSS source, whether internal or external, is associated with an HTML file, Dreamweaver will display the name of the CSS document in the CSS Styles panel whenever the HTML file is open. If the CSS is being stored internally, the rules will be grouped under the heading “style”, indicating that it has been defined within a style element in the HEAD area of the current page.

Dreamweaver training courses in London.

August 5, 2009

Working With Documents in Dreamweaver CS4

Filed under: Dreamweaver — admin @ 8:05 am

Dreamweaver offers a number of ways of creating new documents and beginners often struggle to see which method should be used in which circumstances. The first method is to use one of the links on the welcome screen which appears in the middle of the screen when the program is first launched. This allows you to create a new file of a given type, e.g. HTML, CSS, JavaScript or PHP. The second is to go to the File menu and choose New. This displays the New Document dialog which allows you specify a huge variety of useful documents which can either be blank or hold useful content. The third method is to choose New from the menu within the Files panel.

The benefit of using the Welcome Screen method is speed and convenience. The Welcome Screen appears on program launch but it also reappears whenever no files are open. To create a new HTML file, simply click on the HTML link in the Create New column. Dreamweaver will create the document without displaying any dialog boxes. When viewed in Preview mode, the document will appear completely blank. However, in Code view, you will notice that Dreamweaver has created an HTML page complete with HTML declaration and an HTML element containing a HEAD and BODY element. While the HEAD element contains a title, the BODY element is empty and this is why nothing shows up when the page is viewed in Preview mode.

By contrast, when we use File – New to create a document, Dreamweaver allows us to choose not only the type of document we wish to create but also the contents. For example if we choose to create a basic HTML page, we don’t have to settle for a blank page: we can choose one of Dreamweaver’s built in CSS layouts as a starting point and then customize the page to suit our own purposes.

When using either the Welcome screen or File – New to create a new document, the document created is open in memory and it then up to the user to save it in a given location. The benefit of creating documents in the Files panel is that files are created on disk and remain closed. This is extremely useful when creating a new site since it allows a developer to create the entire site structure before adding content into any of the pages.

Before building a site, it is important that you have a plan of how the site will work and the pages it will contain. Creating all of these pages before adding content to any pages is a good way of minimizing the risk of creating link errors. Let’s say you are working on a page called “index.htm” and you want to create a link to a page called “contact.htm”, if the “contact.htm” page doesn’t yet exist, you can still create the link. However, when you come to create “contact.htm”, you need remember to match the name precisely to the one you used when creating the link.

Powered by WordPress