Saturday, August 9, 2008

Controls in ASP.NET

Displays the values of a data source in a table where each column represents a field and each row represents a record. The GridView control enables you to select, sort, and edit these items.

This is the most used control in development.
  • A common question is often asked that which control is better and which is to be used?
There are basically 3 most important controls used to display data.
1)Repeater
2)Detail View
3)Datalist
4)Gridview


Repeater
The Repeater control is a data-bound control that uses templates to display data. The Repeater control works by looping through the records in your data source and then repeating the rendering of one of its templates called the ItemTemplate, one that contains the records that the control needs to render.
A Repeater control can be used to build small and Flexible reports with the templates for the items. It supports the following five templates.
  • HeaderTemplate : Can be used to create the Header Rows of the Table data being presented by Repeater control.
  • FooterTemplate : Can be used to create the Footer Rows of the Table data being presented by Repeater control.
  • ItemTemplate : Used for formatting the Items and rows to be displayed.
  • AlternatingItemTemplate : Alternating items formatting.
  • SeparatorTemplate : Styles for separating rows and columns.
Detail View

The DetailsView control is similar to the GridView control with one notable exception—it displays one record at a time. It is a data-bound user interface control that renders a single record at a time from its associated data source, optionally providing paging buttons to navigate between records.
The DetailsView control displays a single record from a data source, where each data row represents a field in the record. It is often used in combination with a GridView control for master/detail scenarios.
The interesting features in detail view are:
  • Automatic paging and sorting with no coding needed
  • Automatic Insert, Update, and Delete capabilities
  • Complete command button functionality (such as the Edit, Update, and Cancel buttons) without any coding
  • Minimal amount of coding involved than in previous versions of the framework
DATALIST

The DataList control like the Repeater control is a template driven, light weight control, and acts as a container of repeated data items. The templates in this control are used to define the data that it will contain. It is flexible in the sense that you can easily customize the display of one or more records that are displayed in the control. You have a property in the DataList control called RepeatDirection that can be used to customize the layout of the control.

The RepeatDirection property can accept one of two values, that is, Vertical or Horizontal. The RepeatDirection is Vertical by default. However, if you change it to Horizontal, rather than displaying the data as rows and columns, the DataList control will display them as a list of records with the columns in the data rendered displayed as rows.

GRIDVIEW

Displays the values of a data source in a table where each column represents a field and each row represents a record. The GridView control enables you to select, sort, and edit these items.


The GridView control is used to display the values of a data source in a table. Each column represents a field, while each row represents a record. The GridView control supports the following features:

  • Binding to data source controls, such as SqlDataSource.

  • Built-in sort capabilities.

  • Built-in update and delete capabilities.

  • Built-in paging capabilities.

  • Built-in row selection capabilities.

  • Programmatic access to the GridView object model to dynamically set properties, handle events, and so on.

  • Multiple key fields.

  • Multiple data fields for the hyperlink columns.

  • Customizable appearance through themes and styles.














Friday, July 11, 2008

How to add FCK editor in ASP.NET Application

Step 1

Firstly download the FCKeditor .Net package from the fck editor website i. from here fckeditor.net/download.
Step 2

Unzip the downloaded file. There you will find the original source code of the control and a compiled version of it. The file is called

FredCK.FCKeditorV2.dll. It can be in either of the two files:

* bin/Release/1.1/ - the version designed for ASP.NET 1.1
* bin/Release/2.0/ - the version designed for ASP.NET 2.0

Consider the compiled DLL file, and create a reference to it in your project. You have two options to do that:

1. Manually copy the FredCK.FCKeditorV2.dll file to the "bin" directory of your web site.
2. Right-click "References" in your Visual Studio.NET project in the "Solution Explorer". Use "Browse" to select the FredCK.FCKeditorV2.dll file from the

directory you have saved it in.

You can include the control in your Visual Studio.NET controls toolbox. Just right-click on it and select "Choose Items". Then, just point to the

FredCK.FCKeditorV2.dll file by using the "Browse" option. Remember to make sure that you have the latest version of the dll. It may be worthwhile to

recompile from the source if you are having issues getting the upload and connector features to work.
___________________________________
Integration

Step 1

Create an ASP.NET page. To create an instance of the editor, you have two options:

1. Drag and drop the control "FCKeditor" from the toolbox to you page.(this method will only work if you included the "FCKeditor" control in the toolbox -

see Step 2 for the description)
2. Manually add lines of code in your ASP.NET source page:

* Include this line in the top of the page:

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
NOTE- "<" sign has been removed from the post kindly apply it in place of * *form runat="server">:
*fckeditorv2:fckeditor id="FCKeditor1" runat="server">



Step 2

The editor is now ready to be used. Just open the page in your browser to see it at work.