Aspnet.grid view

8,088
-1

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
8,088
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
126
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Aspnet.grid view

  1. 1. ComponentOne GridView for ASP.NET AJAX
  2. 2. Copyright  1987-2010 ComponentOne LLC. All rights reserved. Corporate Headquarters ComponentOne LLC 201 South Highland Avenue 3rd Floor Pittsburgh, PA 15206 ∙ USA Internet: info@ComponentOne.com Web site: http://www.componentone.com Sales E-mail: sales@componentone.com Telephone: 1.800.858.2739 or 1.412.681.4343 (Pittsburgh, PA USA Office) Trademarks The ComponentOne product name is a trademark and ComponentOne is a registered trademark of ComponentOne LLC. All other trademarks used herein are the properties of their respective owners. Warranty ComponentOne warrants that the original CD (or diskettes) are free from defects in material and workmanship, assuming normal use, for a period of 90 days from the date of purchase. If a defect occurs during this time, you may return the defective CD (or disk) to ComponentOne, along with a dated proof of purchase, and ComponentOne will replace it at no charge. After 90 days, you can obtain a replacement for a defective CD (or disk) by sending it and a check for $25 (to cover postage and handling) to ComponentOne. Except for the express warranty of the original CD (or disks) set forth here, ComponentOne makes no other warranties, express or implied. Every attempt has been made to ensure that the information contained in this manual is correct as of the time it was written. We are not responsible for any errors or omissions. ComponentOne’s liability is limited to the amount you paid for the product. ComponentOne is not liable for any special, consequential, or other damages for any reason. Copying and Distribution While you are welcome to make backup copies of the software for your own use and protection, you are not permitted to make copies for the use of anyone else. We put a lot of time and effort into creating this product, and we appreciate your support in seeing that it is used by licensed users only. This manual was produced using ComponentOne Doc-To-Help™.
  3. 3. Table of Contents ComponentOne GridView for ASP.NET AJAX Overview............................................................. 1 What's New in GridView for ASP.NET AJAX.........................................................................................1 Revision History.......................................................................................................................................2 What's New in 2010 v1.............................................................................................................................2 What's New in 2009 v3.............................................................................................................................5 What's New in 2009 v2.............................................................................................................................6 Installing GridView for ASP.NET AJAX .................................................................................................6 GridView for ASP.NET AJAX Setup Files...............................................................................................6 System Requirements ...............................................................................................................................7 Installing Demonstration Versions ............................................................................................................7 Uninstalling GridView for ASP.NET AJAX.............................................................................................7 Deploying your Application in a Medium Trust Environment ..................................................................8 End-User License Agreement .................................................................................................................11 Licensing FAQs .....................................................................................................................................11 What is Licensing? .................................................................................................................................11 How does Licensing Work? ....................................................................................................................11 Common Scenarios ................................................................................................................................12 Troubleshooting .....................................................................................................................................14 Technical Support ..................................................................................................................................15 Redistributable Files ...............................................................................................................................16 About This Documentation ....................................................................................................................16 Namespaces ...........................................................................................................................................17 Creating an AJAX-Enabled ASP.NET Project........................................................................................18 Adding the C1GridView Component to a Project ...................................................................................20 Upgrading From WebGrid for ASP.NET ...............................................................................................21 Column Changes....................................................................................................................................21 Renamed Members ................................................................................................................................21 New Members........................................................................................................................................23 Removed Members ................................................................................................................................25 Key Features.......................................................................................................................26 GridView for ASP.NET AJAX Quick Start ...............................................................................29 Step 1 of 3: Binding C1GridView to a DataSource ..................................................................................29 Step 2 of 3: Customizing the C1GridView Control..................................................................................30 Step 3 of 3: Running the Application ......................................................................................................31 Design-Time Support............................................................................................................37 C1GridView Smart Tag ..........................................................................................................................37 C1GridView Context Menu....................................................................................................................39 Property Builder .....................................................................................................................................39 General Tab ...........................................................................................................................................41 Columns Tab..........................................................................................................................................41 Paging Tab .............................................................................................................................................43 Format Tab ............................................................................................................................................45 Grouping Tab.........................................................................................................................................45 Using GridView for ASP.NET AJAX ......................................................................................46 Visual Styles ...........................................................................................................................................47 Changing the Visual Style.......................................................................................................................49 Customizing the Control's Appearance ...................................................................................................49 Keyboard Navigation .............................................................................................................................50 iii
  4. 4. Editing Rows..........................................................................................................................................51 Grouping................................................................................................................................................51 Setting Grouping Properties at Design Time ...........................................................................................51 Setting Grouping Properties at Run Time ...............................................................................................52 Collapsing and Expanding Groups .........................................................................................................53 Sorting ...................................................................................................................................................54 Filtering .................................................................................................................................................55 Paging ....................................................................................................................................................56 Using AJAX...........................................................................................................................................57 Client-Side Functionality.......................................................................................................57 Client-Side Properties .............................................................................................................................58 GridView for ASP.NET AJAX Samples ...................................................................................59 GridView for ASP.NET AJAX Task-Based Help ........................................................................59 Binding the Grid to a Data Source ..........................................................................................................60 Binding the Grid in a Web Site Project ...................................................................................................60 Binding the Grid in a Web Application Project .......................................................................................61 Automatically Updating the Data Source ...............................................................................................61 Using the Property Builder .....................................................................................................................62 Setting Properties Using the Property Builder .........................................................................................62 Adding Columns Using the Property Builder ..........................................................................................64 Formatting the Grid's Content ................................................................................................................64 Customizing Columns Using DataFormatString.....................................................................................65 Customizing Columns Using ValueLists.................................................................................................66 Automatically Sorting Columns..............................................................................................................67 Hiding Specified Columns ......................................................................................................................68 Setting the Footer Text ...........................................................................................................................68 Creating Column Header Bands .............................................................................................................69 Formatting a Column as Currency..........................................................................................................72 Adding a Caption to the Grid .................................................................................................................73 Adding Controls to a Column.................................................................................................................73 Adding Template Columns.....................................................................................................................73 Binding Template Columns ....................................................................................................................74 Adding CheckBox or ListBox Controls to a Column...............................................................................76 Adding ComponentOne Input for ASP.NET AJAX Controls .................................................................77 Customizing the Grid's Appearance........................................................................................................79 Adding Borders and Gridlines to the Grid ..............................................................................................79 Setting Column Width............................................................................................................................81 Formatting Rows and Cells Meeting Specific Criteria .............................................................................81 Changing the Color of Column Headers .................................................................................................83 Using Aggregates and Grouping .............................................................................................................84 Merging Rows ........................................................................................................................................84 Grouping Properties ...............................................................................................................................85 Adding Outlook-Style Grouping.............................................................................................................86 Creating a Pageable Grid........................................................................................................................87 Adding Paging........................................................................................................................................87 Changing Paging Types and Styles .........................................................................................................88 Using Client-Side Scrolling .....................................................................................................................89 Creating a Scrollable Grid ......................................................................................................................89 Creating a Non-Scrollable Column .........................................................................................................90 Creating a Non-Scrollable Row ..............................................................................................................91 Updating the Grid with AJAX................................................................................................................92 Moving Columns....................................................................................................................................92 Editing a Record.....................................................................................................................................93 Paging the Grid ......................................................................................................................................93 iv
  5. 5. Selecting a Record ..................................................................................................................................94 Sorting Columns ....................................................................................................................................94 Filtering Columns...................................................................................................................................95 v
  6. 6. ComponentOne GridView for ASP.NET AJAX Overview ComponentOne GridView for ASP.NET AJAX is a flexible, Getting Started Microsoft GridView compatible, ASP.NET grid control used to display items from a data source in an interactive, fully Get started with the customizable table. following topics: ComponentOne GridView for ASP.NET AJAX includes one - Key Features (page control, C1GridView, which is used to generate a table of 26) items, allowing users to select, edit, delete, sort, filter, and - Quick Start (page 29) group data at run time. GridView for ASP.NET AJAX provides the compelling ability to display data across multiple - Samples (page 59) pages and provide user interactivity with default or - Upgrading From customizable navigation controls. GridView for ASP.NET WebGrid for AJAX is AJAX standards-compliant and AJAX enhanced. ASP.NET (page 21) This means that run-time data can be formatted, manipulated or reloaded easily by the UI. Manage the C1GridView column collection, paging behavior, and edit the control design without code using the C1GridView control's extensive design-time support. Microsoft GridView compatibility allows you to quickly convert existing projects and integrate productively with GridView for ASP.NET AJAX right away – so get started with GridView for ASP.NET AJAX today! What's New in GridView for ASP.NET AJAX This documentation was last revised for 2010 v2 on June 28, 2010. This section describes the new features and members added in this release, as well as breaking changes that were made. In the 2010 v2 release the following enhancements were made to GridView for ASP.NET AJAX:  Keyboard Support Additional keyboard support was added to the C1GridView control. At run time, users can now enter the client-side editing mode on a cell by pressing any alphanumeric key. Users can also now navigate through the grid by using the arrow and navigation keys (such as Home, End, and so on). See Keyboard Navigation (page 50) for details.  New Members New members, including some replacing deprecated members, were added to GridView for ASP.NET AJAX in the 2010 v2 release. For details see the new member table and the list of breaking changes below. New Members The following members were added to the C1GridView control's object model in the 2010 v2 release: 1
  7. 7. Type Member Description C1GridView ErrorText property Gets or sets the text to display if an error occurs during a callback to the server. C1HyperLinkField DataNavigateUrlFields Using the DataNavigateUrlFields property you can property combine multiple fields from the data source to create hyperlinks for the C1HyperLinkField column. C1ImageField DataAlternateTextField Gets or sets the name of the column from the property data source that contains the values to bind to the AlternateText property of each image in a C1ImageField object. DataImageUrlField property Gets or sets the name of the column from the data source that contains the values to bind to the ImageUrl property of each image in a C1ImageField object. Breaking Changes The following breaking changes were made to GridView for ASP.NET AJAX in the 2010 v2 release:  The C1ImageField class' DataAlternateTextColumn and DataImageUrlColumn properties were deprecated and replaced with the DataAlternateTextField and DataImageUrlField properties accordingly.  The C1HyperLinkField class' DataNavigateUrlField property has been deprecated and replaced with the DataNavigateUrlFields property. Tip: A version history containing a list of new features, improvements, fixes, and changes for each product is available on HelpCentral at http://helpcentral.componentone.com/VersionHistory.aspx. Revision History The revision history details recent enhancements to ComponentOne GridView for ASP.NET AJAX. What's New in 2010 v1 In the 2010 v1 release the following enhancements were made to GridView for ASP.NET AJAX:  Client-Side Selection You can now implement client-side selection of grid cells, columns, and rows depending upon the selection mode you set. New members were added to provide CSOM access to selected elements.  Client-Side Cell Editing You can now implement the editing of grid cells on the client side. New client-side members were added to implement this functionality. New Types The following types were added to the C1GridView control's server-side object model in the 2010 v1 release: Type Description C1GridViewBeginRowUpdat Provides data for the BeginRowUpdate event of the C1GridView control. eEventArgs class 2
  8. 8. C1GridViewEndRowUpdated Provides data for the EndRowUpdated event of the C1GridView control. EventArgs class C1GridViewSelectionMode Specifies client-side selection behavior of the C1GridView control. enumeration New Members The following server-side members were added to the C1GridView control's object model in the 2010 v1 release: Type Member Description C1GridView AllowClientEditing property Gets or sets a value that determines whether client editing is enabled. The default value is False. In client editing mode grid does not update underlying dataset automatically. You should implement dataset update using BeginRowUpdate, RowUpdating, and EndRowUpdated event handlers. BeginRowUpdate event Occurs in client editing mode when edits done by user should be persisted to underlying dataset. Fires at the very beginning of the update procedure. You can perform any actions preceding update here, for example, establish database connectivity. ClientOnAfterCellEdit property Gets or sets the method to be called after сell editing is completed. ClientOnAfterCellUpdate Gets or sets the method to be called after the сell property is updated. ClientOnBeforeCellEdit Gets or sets the method to be called before a cell property enters edit mode. ClientOnBeforeCellUpdate Gets or sets the method to be called before the property сell is updated. ClientOnSelectionChanged Gets or sets the method to be called after property selection is changed. EndRowUpdated event Occurs in client editing mode when edits done by user should be persisted to underlying dataset. Fires at the end of the update procedure. You can perform finalization steps of update procedure here, for example, close database connection. SelectionMode property Gets or sets a C1GridViewSelectionMode enumeration member that represents grid's client-side selection behavior. The default value SingleRow. WaitImagePosition property Gets or sets the position of the wait image. New Client-Side Types The following client-side types were added to the C1GridView control's client-side object model in the 2010 v1 release: 3
  9. 9. Type Description AfterCellEditEventArgs class Contains event data for the AfterCellEdit event of the C1GridView control. AfterCellUpdateEventArgs Contains event data for the AfterCellUpdate event of the C1GridView class control. BeforeCellEditEventArgs Contains event data for the BeforeCellEdit event of the C1GridView class control. BeforeCellUpdateEventArgs Contains event data for the BeforeCellUpdate event of the C1GridView class control. C1GridViewSelection class Class that represents selection in the C1GridView control. C1GridViewSelectionMode Specifies client-side selection behavior of the C1GridView control. enumeration CellInfo class Class that represents a single cell. CellInfoOrderedCollection Ordered read-only collection of a CellInfo objects. class CellRange class Specifies a range of cells determined by two cells. EditState class Determines the state of the C1GridView control in client-side editing mode. SelectedColumnsAccessor Provides access to columns which cells are selected. class SelectedRowsAccessor class Provides access to rows which cells are selected. SelectionChangedEventArgs Contains event data for the SelectionChanged event of the C1GridView class control. New Client-Side Members The following client-side members were added to the C1GridView control's object model in the 2010 v1 release: Type Member Description C1GridView AllowClientEditing property Gets a value that determines whether client-side editing is enabled. BeginEdit method Puts the current cell in editing mode. EditState property Gets a value indicating the C1GridView control's edit state. SelectedCell property Gets a first selected cell in the grid. Returns a first selected cell in the grid or null if no cells are selected. Selection property Gets a C1GridViewSelection object that manages selection in the grid. SelectionMode property Gets or sets a C1GridViewSelectionMode enumeration member that represents grid's client-side selection behavior. Update method Sends edits done by user to server in client editing mode. Works only if the 4
  10. 10. AllowClientEditing property is set to True. What's New in 2009 v3 In the 2009 v3 release the following enhancements were made to GridView for ASP.NET AJAX:  Currency was improved (current column and row selection and current cell marquee). You can now better change the current cell at run time using key keyboard navigation. For more details and a list of keyboard navigation shortcuts, see Keyboard Navigation (page 50).  You can now further customize the loading wait image element by setting where it should be positioned. You can set the WaitImagePosition property to an ElementPosition enumeration value to determine where the image should appear. New Enumerations The following enumerations were added to the C1GridView control's client and server-side object models in the 2009 v3 release: Type Description TabNavigation enumeration Specifies the tab navigation behavior. See Keyboard Navigation (page 50) for more information. ElementPosition Specifies the position of the element. enumeration New Members The following server-side members were added to the C1GridView control's object model in the 2009 v3 release: Type Member Description C1GridView AllowKeyboardNavigation Gets or sets a value that determines whether property keyboard navigation is enabled. ClientOnCurrencyChanging Get or sets the method to be called before property currency is changed. TabNavigation property Gets or sets a value indicating how control handles the tab key in order to change currency. See Keyboard Navigation (page 50) for more information. WaitImagePosition property Gets or sets the position of the wait image. New Client-Side Members The following client-side members were added to the C1GridView control's object model in the 2009 v3 release: Type Member Description C1GridView ClientOnCurrencyChanging Get or sets the method to be called before property currency is change. ColumnWidthChanged event Fires after column width is changed. CurrencyChanged event Fires after the currency is changed. CurrencyChanging event Fires before the currency is changed. 5
  11. 11. CurrentCell property Gets the current cell. CurrentColumn property Gets the current column. CurrentCellIndex property Gets or sets the index of the current cell. CurrentRowIndex property Gets or sets the index of the current row. TabNavigation property Gets or sets a value indicating how control handles the tab key in order to change currency. WaitImagePosition property Gets or sets the position of the wait image. What's New in 2009 v2 In the 2009 v2 release the following enhancement was made to GridView for ASP.NET AJAX:  GridView for ASP.NET AJAX now supports grouping templated columns. Installing GridView for ASP.NET AJAX The following sections provide helpful information on installing GridView for ASP.NET AJAX. GridView for ASP.NET AJAX Setup Files The ComponentOne Studio for ASP.NET AJAX installation program will create the following directory: C:Program FilesComponentOneStudio for ASP.NET. This directory contains the following subdirectories: Bin Contains copies of all binaries (DLLs, Exes) in the ComponentOne Visual Studio ASP.NET package. H2Help Contains documentation for Studio for ASP.NET AJAX components. C1WebUi Contains files (at least a readme.txt) related to the product. C1WebUiVisualStyles Contains all external file themes. Samples Samples for the product are installed in the ComponentOne Samples folder by default. The path of the ComponentOne Samples directory is slightly different on Windows XP and Windows 7/Vista machines: Windows XP path: C:Documents and Settings<username>My DocumentsComponentOne Samples Windows 7/Vista path: C:Users<username>DocumentsComponentOne Samples The ComponentOne Samples folder contains the following subdirectories: Common Contains support and data files that are used by many of the demo programs. Studio for Contains samples and tutorials for GridView for ASP.NET AJAX. ASP.NETC1WebUi Samples can be accessed from the ComponentOne Sample Explorer. To view samples, on your desktop, click the Start button and then click All Programs | ComponentOne | Studio for ASP.NET | Samples | Palomino Samples. 6
  12. 12. System Requirements System requirements include the following: Operating Systems: Windows 2000 Windows Server® 2003 Windows Server® 2008 Windows XP SP2 Windows Vista™ Windows 7 Web Server: Microsoft Internet Information Services (IIS) 5.0 or later Environments: .NET Framework 2.0 or later Visual Studio 2005 or later Internet Explorer® 6.0 or later Firefox® 2.0 or later Safari® 2.0 or later Disc Drive: CD or DVD-ROM drive if installing from CD Note: GridView for ASP.NET AJAX requires Microsoft ASP.NET AJAX Extensions installed and a ScriptManager on the page before the C1GridView control is placed on the page. You must create an ASP.NET AJAX-Enabled Project so that the ScriptManager and Microsoft AJAX Extensions are included on the page. For more information, see Creating an AJAX-Enabled ASP.NET Project (page 18). For more information about Microsoft ASP.NET AJAX Extensions, see http://ajax.asp.net/. For information about the ScriptManager, see MSDN. Installing Demonstration Versions If you wish to try GridView for ASP.NET AJAX and do not have a serial number, follow the steps through the installation wizard and use the default serial number. The only difference between unregistered (demonstration) and registered (purchased) versions of our products is that registered versions will stamp every application you compile so a ComponentOne banner will not appear when your users run the applications. Uninstalling GridView for ASP.NET AJAX To uninstall Studio for ASP.NET AJAX: 1. Open the Control Panel and select Add or Remove Programs or Programs and Features (Windows 7/Vista). 2. Select ComponentOne Studio for ASP.NET AJAX and click the Remove button. 3. Click Yes to remove the program. 7
  13. 13. Deploying your Application in a Medium Trust Environment Depending on your hosting choice, you may need to deploy your Web site or application in a medium trust environment. Often in a shared hosting environment, medium trust is required. In a medium trust environment several permissions are unavailable or limited, including OleDbPermission, ReflectionPermission, and FileIOPermission. You can configure your Web.config file to enable these permissions. Note: ComponentOne controls will not work in an environment where reflection is not allowed. ComponentOne ASP.NET controls include the AllowPartiallyTrustedCallers() assembly attribute and will work under the medium trust level with some changes to the Web.config file. Since this requires some control over the Web.config file, please check with your particular host to determine if they can provide the rights to override these security settings. Modifying or Editing the Config File In order to add permissions, you can edit the exiting web_mediumtrust.config file or create a custom policy file based on the medium trust policy. If you modify the existing web_mediumtrust.config file, all Web applications will have the same permissions with the permissions you have added. If you want applications to have different permissions, you can instead create a custom policy based on medium trust. Edit the Config File In order to add permissions, you can edit the exiting web_mediumtrust.config file. To edit the exiting web_mediumtrust.config file, complete the following steps: 1. Locate the medium trust policy file web_mediumtrust.config located by default in the %windir%Microsoft.NETFramework{Version}CONFIG directory. 2. Open the web_mediumtrust.config file. 3. Add the permissions that you want to grant. For examples, see Adding Permissions (page 9). Create a Custom Policy Based on Medium Trust In order to add permissions, you can create a custom policy file based on the medium trust policy. To create a custom policy file, complete the following steps: 1. Locate the medium trust policy file web_mediumtrust.config located by default in the %windir%Microsoft.NETFramework{Version}CONFIG directory. 2. Copy the web_mediumtrust.config file and create a new policy file in the same directory. Give the new a name that indicates that it is your variation of medium trust; for example, AllowReflection_Web_MediumTrust.config. 3. Add the permissions that you want to grant. For examples, see Adding Permissions (page 9). 4. Enable the custom policy file on your application by modifying the following lines in your web.config file under the <system.web> node: <system.web> <trust level="CustomMedium" originUrl=""/> <securityPolicy> <trustLevel name="CustomMedium" policyFile="AllowReflection_Web_MediumTrust.config"/> </securityPolicy> ... </system.web> Note: Your host may not allow trust level overrides. Please check with your host to see if you have these rights. 8
  14. 14. Allowing Deserialization To allow the deserialization of the license added to App_Licenses.dll by the Microsoft IDE, you should add the SerializationFormatter flag to security permission to the Web.config file. Complete the steps in the Modifying or Editing the Config File (page 8) topic to create or modify a policy file before completing the following. Add the SerializationFormatter flag to the <IPermission class="SecurityPermission"> tag so that it appears similar to the following: <NamedPermissionSets> <PermissionSet class="NamedPermissionSet" version="1" Name="ASP.Net"> <IPermission class="SecurityPermission" version="1" Flags="Assertion, Execution, ControlThread, ControlPrincipal, RemotingConfiguration, SerializationFormatter"/> ... </PermissionSet> </NamedPermissionSets> Adding Permissions You can add permission, including ReflectionPermission, OleDbPermission, and FileIOPermission, to the web.config file. Note that ComponentOne controls will not work in an environment where reflection is not allowed. Complete the steps in the Modifying or Editing the Config File (page 8) topic to create or modify a policy file before completing the following. ReflectionPermission By default ReflectionPermission is not available in a medium trust environment. ComponentOne ASP.NET controls require reflection permission because LicenseManager.Validate() causes a link demand for full trust. To add reflection permission, complete the following: 1. Open the web_mediumtrust.config file or a file created based on the web_mediumtrust.config file. 2. Add the following <SecurityClass> tag after the <SecurityClasses> tag so that it appears similar to the following: <SecurityClasses> <SecurityClass Name="ReflectionPermission" Description="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> ... </SecurityClasses> 3. Add the following <IPermission> tag after the <NamedPermissionSets> tag so it appears similar to the following: <NamedPermissionSets> <PermissionSet class="NamedPermissionSet" version="1" Name="ASP.Net"> <IPermission class="ReflectionPermission" version="1" Flags="ReflectionEmit,MemberAccess" /> ... </PermissionSet> </NamedPermissionSets> 4. Save and close the web_mediumtrust.config file. 9
  15. 15. OleDbPermission By default OleDbPermission is not available in a medium trust environment. This means you cannot use the ADO.NET managed OLE DB data provider to access databases. If you wish to use the ADO.NET managed OLE DB data provider to access databases, you must modify the web_mediumtrust.config file. To add OleDbPermission, complete the following steps: 1. Open the web_mediumtrust.config file or a file created based on the web_mediumtrust.config file. 2. Add the following <SecurityClass> tag after the <SecurityClasses> tag so that it appears similar to the following: <SecurityClasses> <SecurityClass Name="OleDbPermission" Description="System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> ... </SecurityClasses> 3. Add the following <IPermission> tag after the <NamedPermissionSets> tag so it appears similar to the following: <NamedPermissionSets> <PermissionSet class="NamedPermissionSet" version="1" Name="ASP.Net"> <IPermission class="OleDbPermission" version="1" Unrestricted="true"/> ... </PermissionSet> </NamedPermissionSets> 4. Save and close the web_mediumtrust.config file. FileIOPermission By default, FileIOPermission is not available in a medium trust environment. This means no file access is permitted outside of the application's virtual directory hierarchy. If you wish to allow additional file permissions, you must modify the web_mediumtrust.config file. To modify FileIOPermission to allow read access to a specific directory outside of the application's virtual directory hierarchy, complete the following steps: 1. Open the web_mediumtrust.config file or a file created based on the web_mediumtrust.config file. 2. Add the following <SecurityClass> tag after the <SecurityClasses> tag so that it appears similar to the following: <SecurityClasses> <SecurityClass Name="FileIOPermission" Description="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> ... </SecurityClasses> 3. Add the following <IPermission> tag after the <NamedPermissionSets> tag so it appears similar to the following: <NamedPermissionSets> <PermissionSet class="NamedPermissionSet" version="1" Name="ASP.Net"> ... <IPermission class="FileIOPermission" version="1" Read="C:SomeDir;$AppDir$" Write="$AppDir$" Append="$AppDir$" PathDiscovery="$AppDir$" /> ... 10
  16. 16. </PermissionSet> </NamedPermissionSets> 4. Save and close the web_mediumtrust.config file. End-User License Agreement All of the ComponentOne licensing information, including the ComponentOne end-user license agreements, frequently asked licensing questions, and the ComponentOne licensing model, is available online at http://www.componentone.com/SuperPages/Licensing/. Licensing FAQs This section describes the main technical aspects of licensing. It may help the user to understand and resolve licensing problems he may experience when using ComponentOne WinForms and ASP.NET products. What is Licensing? Licensing is a mechanism used to protect intellectual property by ensuring that users are authorized to use software products. Licensing is not only used to prevent illegal distribution of software products. Many software vendors, including ComponentOne, use licensing to allow potential users to test products before they decide to purchase them. Without licensing, this type of distribution would not be practical for the vendor or convenient for the user. Vendors would either have to distribute evaluation software with limited functionality, or shift the burden of managing software licenses to customers, who could easily forget that the software being used is an evaluation version and has not been purchased. How does Licensing Work? ComponentOne uses a licensing model based on the standard set by Microsoft, which works with all types of components. Note: The Compact Framework components use a slightly different mechanism for run-time licensing than the other ComponentOne components due to platform differences. When a user decides to purchase a product, he receives an installation program and a Serial Number. During the installation process, the user is prompted for the serial number that is saved on the system. (Users can also enter the serial number by clicking the License button on the About Box of any ComponentOne product, if available, or by rerunning the installation and entering the serial number in the licensing dialog box.) When a licensed component is added to a form or Web page, Visual Studio obtains version and licensing information from the newly created component. When queried by Visual Studio, the component looks for licensing information stored in the system and generates a run-time license and version information, which Visual Studio saves in the following two files:  An assembly resource file which contains the actual run-time license  A "licenses.licx" file that contains the licensed component strong name and version information These files are automatically added to the project. In WinForms and ASP.NET 1.x applications, the run-time license is stored as an embedded resource in the assembly hosting the component or control by Visual Studio. In ASP.NET 2.x applications, the run-time license may also be stored as an embedded resource in the App_Licenses.dll assembly, which is used to store all run-time licenses for all components directly hosted by WebForms in the application. Thus, the App_licenses.dll must always be deployed with the application. 11
  17. 17. The licenses.licx file is a simple text file that contains strong names and version information for each of the licensed components used in the application. Whenever Visual Studio is called upon to rebuild the application resources, this file is read and used as a list of components to query for run-time licenses to be embedded in the appropriate assembly resource. Note that editing or adding an appropriate line to this file can force Visual Studio to add run-time licenses of other controls as well. Note that the licenses.licx file is usually not shown in the Solution Explorer; it appears if you press the Show All Files button in the Solution Explorer's Toolbox, or from Visual Studio's main menu, select Show All Files on the Project menu. Later, when the component is created at run time, it obtains the run-time license from the appropriate assembly resource that was created at design time and can decide whether to simply accept the run-time license, to throw an exception and fail altogether, or to display some information reminding the user that the software has not been licensed. All ComponentOne products are designed to display licensing information if the product is not licensed. None will throw licensing exceptions and prevent applications from running. Common Scenarios The following topics describe some of the licensing scenarios you may encounter. Creating components at design time This is the most common scenario and also the simplest: the user adds one or more controls to the form, the licensing information is stored in the licenses.licx file, and the component works. Note that the mechanism is exactly the same for Windows Forms and Web Forms (ASP.NET) projects. Creating components at run time This is also a fairly common scenario. You do not need an instance of the component on the form, but would like to create one or more instances at run time. In this case, the project will not contain a licenses.licx file (or the file will not contain an appropriate run-time license for the component) and therefore licensing will fail. To fix this problem, add an instance of the component to a form in the project. This will create the licenses.licx file and things will then work as expected. (The component can be removed from the form after the licenses.licx file has been created). Adding an instance of the component to a form, then removing that component, is just a simple way of adding a line with the component strong name to the licenses.licx file. If desired, you can do this manually using notepad or Visual Studio itself by opening the file and adding the text. When Visual Studio recreates the application resources, the component will be queried and its run-time license added to the appropriate assembly resource. Inheriting from licensed components If a component that inherits from a licensed component is created, the licensing information to be stored in the form is still needed. This can be done in two ways:  Add a LicenseProvider attribute to the component. This will mark the derived component class as licensed. When the component is added to a form, Visual Studio will create and manage the licenses.licx file, and the base class will handle the licensing process as usual. No additional work is needed. For example: [LicenseProvider(typeof(LicenseProvider))] class MyGrid: C1.Win.C1FlexGrid.C1FlexGrid { // ... } 12
  18. 18.  Add an instance of the base component to the form. This will embed the licensing information into the licenses.licx file as in the previous scenario, and the base component will find it and use it. As before, the extra instance can be deleted after the licenses.licx file has been created. Please note, that C1 licensing will not accept a run-time license for a derived control if the run-time license is embedded in the same assembly as the derived class definition, and the assembly is a DLL. This restriction is necessary to prevent a derived control class assembly from being used in other applications without a design time license. If you create such an assembly, you will need to take one of the actions previously described create a component at run time. Using licensed components in console applications When building console applications, there are no forms to add components to, and therefore Visual Studio won't create a licenses.licx file. In these cases, create a temporary Windows Forms application and add all the desired licensed components to a form. Then close the Windows Forms application and copy the licenses.licx file into the console application project. Make sure the licenses.licx file is configured as an embedded resource. To do this, right-click the licenses.licx file in the Solution Explorer window and select Properties. In the Properties window, set the Build Action property to Embedded Resource. Using licensed components in Visual C++ applications There is an issue in VC++ 2003 where the licenses.licx is ignored during the build process; therefore, the licensing information is not included in VC++ applications. To fix this problem, extra steps must be taken to compile the licensing resources and link them to the project. Note the following: 1. Build the C++ project as usual. This should create an .exe file and also a licenses.licx file with licensing information in it. 2. Copy the licenses.licx file from the application directory to the target folder (Debug or Release). 3. Copy the C1Lc.exe utility and the licensed DLLs to the target folder. (Don't use the standard lc.exe, it has bugs.) 4. Use C1Lc.exe to compile the licenses.licx file. The command line should look like this: c1lc /target:MyApp.exe /complist:licenses.licx /i:C1.Win.C1FlexGrid.dll 5. Link the licenses into the project. To do this, go back to Visual Studio, right-click the project, select Properties, and go to the Linker/Command Line option. Enter the following: /ASSEMBLYRESOURCE:DebugMyApp.exe.licenses 6. Rebuild the executable to include the licensing information in the application. Using licensed components with automated testing products Automated testing products that load assemblies dynamically may cause them to display a license dialog box. This is the expected behavior since the test application typically does not contain the necessary licensing information, and there is no easy way to add it. This can be avoided by adding the string "C1CheckForDesignLicenseAtRuntime" to the AssemblyConfiguration attribute of the assembly that contains or derives from ComponentOne controls. This attribute value directs the ComponentOne controls to use design-time licenses at run time. For example: #if AUTOMATED_TESTING [AssemblyConfiguration("C1CheckForDesignLicenseAtRuntime")] 13
  19. 19. #endif public class MyDerivedControl : C1LicensedControl { // ... } Note that the AssemblyConfiguration string may contain additional text before or after the given string, so the AssemblyConfiguration attribute can be used for other purposes as well. For example: [AssemblyConfiguration("C1CheckForDesignLicenseAtRuntime,BetaVersion")] THIS METHOD SHOULD ONLY BE USED UNDER THE SCENARIO DESCRIBED. It requires a design time license to be installed on the testing machine. Distributing or installing the license on other computers is a violation of the EULA. Troubleshooting We try very hard to make the licensing mechanism as unobtrusive as possible, but problems may occur for a number of reasons. Below is a description of the most common problems and their solutions. I have a licensed version of a ComponentOne product but I still get the splash screen when I run my project. If this happens, there may be a problem with the licenses.licx file in the project. It either doesn't exist, contains wrong information, or is not configured correctly. First, try a full rebuild (Rebuild All from the Visual Studio Build menu). This will usually rebuild the correct licensing resources. If that fails follow these steps: 1. Open the project and go to the Solution Explorer window. 2. Click the Show All Files button on the top of the window. 3. Find the licenses.licx file and open it. If prompted, continue to open the file. 4. Change the version number of each component to the appropriate value. If the component does not appear in the file, obtain the appropriate data from another licenses.licx file or follow the alternate procedure following. 5. Save the file, then close the licenses.licx tab. 6. Rebuild the project using the Rebuild All option (not just Rebuild). Alternatively, follow these steps: 1. Open the project and go to the Solution Explorer window. 2. Click the Show All Files button on the top of the window. 3. Find the licenses.licx file and delete it. 4. Close the project and reopen it. 5. Open the main form and add an instance of each licensed control. 6. Check the Solution Explorer window, there should be a licenses.licx file there. 7. Rebuild the project using the Rebuild All option (not just Rebuild). For ASP.NET 2.x applications, follow these steps: 1. Open the project and go to the Solution Explorer window. 2. Find the licenses.licx file and right-click it. 14
  20. 20. 3. Select the Rebuild Licenses option (this will rebuild the App_Licenses.licx file). 4. Rebuild the project using the Rebuild All option (not just Rebuild). I have a licensed version of a ComponentOne product on my Web server but the components still behave as unlicensed. There is no need to install any licenses on machines used as servers and not used for development. The components must be licensed on the development machine, therefore the licensing information will be saved into the executable (.exe or .dll) when the project is built. After that, the application can be deployed on any machine, including Web servers. For ASP.NET 2.x applications, be sure that the App_Licenses.dll assembly created during development of the application is deployed to the application bin directory on the Web server. If your ASP.NET application uses WinForms user controls with constituent licensed controls, the run-time license is embedded in the WinForms user control assembly. In this case, you must be sure to rebuild and update the user control whenever the licensed embedded controls are updated. I downloaded a new build of a component that I have purchased, and now I'm getting the splash screen when I build my projects. Make sure that the serial number is still valid. If you licensed the component over a year ago, your subscription may have expired. In this case, you have two options: Option 1 – Renew your subscription to get a new serial number. If you choose this option, you will receive a new serial number that you can use to license the new components (from the installation utility or directly from the About Box). The new subscription will entitle you to a full year of upgrades and to download the latest maintenance builds directly from http://prerelease.componentone.com/. Option 2 – Continue to use the components you have. Subscriptions expire, products do not. You can continue to use the components you received or downloaded while your subscription was valid. Technical Support ComponentOne offers various support options. For a complete list and a description of each, visit the ComponentOne Web site at http://www.componentone.com/Support. Some methods for obtaining technical support include:  Online Support via HelpCentral ComponentOne HelpCentral provides customers with a comprehensive set of technical resources in the form of FAQs, samples, Version Release History, Articles, searchable Knowledge Base, searchable Online Help and more. We recommend this as the first place to look for answers to your technical questions.  Online Support via our Incident Submission Form This online support service provides you with direct access to our Technical Support staff via an online incident submission form. When you submit an incident, you'll immediately receive a response via e-mail confirming that you've successfully created an incident. This email will provide you with an Issue Reference ID and will provide you with a set of possible answers to your question from our Knowledgebase. You will receive a response from one of the ComponentOne staff members via e-mail in 2 business days or less.  Peer-to-Peer Product Forums and Newsgroups ComponentOne peer-to-peer product forums and newsgroups are available to exchange information, tips, and techniques regarding ComponentOne products. ComponentOne sponsors these areas as a forum for 15
  21. 21. users to share information. While ComponentOne does not provide direct support in the forums and newsgroups, we periodically monitor them to ensure accuracy of information and provide comments when appropriate. Please note that a ComponentOne User Account is required to participate in the ComponentOne Product Forums.  Installation Issues Registered users can obtain help with problems installing ComponentOne products. Contact technical support by using the online incident submission form or by phone (412.681.4738). Please note that this does not include issues related to distributing a product to end-users in an application.  Documentation ComponentOne documentation is installed with each of our products and is also available online at HelpCentral. If you have suggestions on how we can improve our documentation, please email the Documentation team. Please note that e-mail sent to the Documentation team is for documentation feedback only. Technical Support and Sales issues should be sent directly to their respective departments. Note: You must create a ComponentOne Account and register your product with a valid serial number to obtain support using some of the above methods. Redistributable Files ComponentOne GridView for ASP .NET is developed and published by ComponentOne LLC. You may use it to develop applications in conjunction with Microsoft Visual Studio or any other programming environment that enables the user to use and integrate the control(s). You may also distribute, free of royalties, the following Redistributable Files with any such application you develop to the extent that they are used separately on a single CPU on the client/workstation side of the network:  C1.Web.UI.2.dll  C1.Web.UI.Controls.2.dll  C1.Web.UI.3.dll  C1.Web.UI.Controls.3.dll  C1.Web.UI.4.dll  C1.Web.UI.Controls.4.dll Site licenses are available for groups of multiple developers. Please contact Sales@ComponentOne.com for details. About This Documentation Acknowledgements Microsoft, Windows, Windows 7, Windows Vista, Windows Server, and Visual Studio are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Firefox is a registered trademark of the Mozilla Foundation. Safari is a trademark of Apple Inc., registered in the U.S. and other countries. ComponentOne If you have any suggestions or ideas for new features or controls, please call us or write: Corporate Headquarters ComponentOne LLC 201 South Highland Avenue 3rd Floor Pittsburgh, PA 15206 • USA 16
  22. 22. 412.681.4343 412.681.4384 (Fax) http://www.componentone.com/ ComponentOne Doc-To-Help This documentation was produced using ComponentOne Doc-To-Help®. Namespaces Namespaces organize the objects defined in an assembly. Assemblies can contain multiple namespaces, which can in turn contain other namespaces. Namespaces prevent ambiguity and simplify references when using large groups of objects such as class libraries. The general namespace for ComponentOne Web products is C1.Web.UI.Controls. The following code fragment shows how to declare a C1GridView using the fully qualified name for this class:  Visual Basic Dim GridView As C1.Web.UI.Controls.C1GridView  C# C1.Web.UI.Controls.C1GridView GridView; Namespaces address a problem sometimes known as namespace pollution, in which the developer of a class library is hampered by the use of similar names in another library. These conflicts with existing components are sometimes called name collisions. Fully qualified names are object references that are prefixed with the name of the namespace where the object is defined. You can use objects defined in other projects if you create a reference to the class (by choosing Add Reference from the Project menu) and then use the fully qualified name for the object in your code. Fully qualified names prevent naming conflicts because the compiler can always determine which object is being used. However, the names themselves can get long and cumbersome. To get around this, you can use the Imports statement (using in C#) to define an alias — an abbreviated name you can use in place of a fully qualified name. For example, the following code snippet creates aliases for two fully qualified names, and uses these aliases to define two objects:  Visual Basic Imports C1GridView = C1.Web.UI.Controls.C1GridView Imports MyGridView = MyProject.Objects.C1GridView Dim grid1 As C1GridView Dim grid2 As MyGridView  C# using C1GridView = C1.Web.UI.Controls.C1GridView; using MyGridView = MyProject.Objects.C1GridView; C1GridView grid1; MyGridView grid2; If you use the Imports statement without an alias, you can use all the names in that namespace without qualification provided they are unique to the project. 17
  23. 23. Creating an AJAX-Enabled ASP.NET Project ComponentOne GridView for ASP.NET AJAX requires you to create an ASP.NET AJAX-Enabled project so that Microsoft ASP.NET AJAX Extensions and a ScriptManager control are included in your project before the C1GridView control is placed on the page. This allows you to take advantage of ASP.NET AJAX and certain features such as partial-page rendering and client-script functionality of the Microsoft AJAX Library. When creating AJAX-Enabled ASP.NET projects, Visual Studios 2008 and 2005 both give you the option of creating a Web site project or a Web application project. MSDN provides detailed information on why you would choose one option over the other. If you are using Visual Studio 2008 with .NET Framework 2.0 or .NET Framework 3.0 or if you are using Visual Studio 2005, you must install the ASP.NET AJAX Extensions 1.0, which can be found at http://ajax.asp.net/. Additionally for Visual Studio 2005 users, creating a Web application project requires installation of a Visual Studio 2005 update and add-in, which can be found at http://msdn.microsoft.com/; however, if you have Visual Studio 2005 SP1, Web application project support is included and a separate download is not required. If you are using Visual Studio 2008 and .NET Framework 3.5, you can easily create an AJAX-enabled ASP.NET project without installing separate add-ins because the framework has a built-in AJAX library and controls. Note: If you are using Visual Studio 2010, see http://www.asp.net/ajax/ for more information on creating an AJAX- Enabled ASP.NET Project. The following table summarizes the installations needed: Visual Studio Version Additional Installation Requirements Visual Studio 2008, .NET Framework 3.5 None Visual Studio 2008 and .NET Framework 2.0 ASP.NET AJAX Extensions 1.0 or 3.0 http://www.asp.net/ajax/downloads/archive/ Visual Studio 2005 Service Pack 1 Visual Studio 2005 ASP.NET AJAX Extensions 1.0 Visual Studio update and add-in (2 installs for Web application project support) The following topics explain how to create both types of projects in Visual Studio 2008 and 2005.  Creating an AJAX-Enabled Web Site Project in Visual Studio 2008 To create a Web site project in Visual Studio 2008, complete the following steps: 1. From the File menu, select New | Web Site. The New Web Site dialog box opens. 2. Select .NET Framework 3.5 or the desired framework in the upper right corner. Note that if you choose .NET Framework 2.0 or 3.0, you must install the extensions first. 3. In the list of templates, select AJAX 1.0-Enabled ASP.NET 2.0 Web Site. 4. Click Browse to specify a location and then click OK. Note: The Web server must have IIS version 6 or later and the .NET Framework installed on it. If you have IIS on your computer, you can specify http://localhost for the server. 18
  24. 24. A new AJAX-Enabled Web Site is created at the root of the Web server you specified. In addition, a new Web Forms page called Default.aspx is displayed and a ScriptManager control is placed on the form. The ScriptManger is needed to enable certain features of ASP.NET AJAX such as partial-page rendering, client-script functionality of the Microsoft AJAX Library, and Web-service calls.  Creating an AJAX-Enabled Web Application Project in Visual Studio 2008 To create a new Web application project in Visual Studio 2008, complete the following steps. 1. From the File menu, select New | Project. The New Project dialog box opens. 2. Select .NET Framework 3.5 or the desired framework in the upper right corner. Note that if you choose .NET Framework 2.0 or 3.0, you must install the extensions first. 3. Under Project Types, choose either Visual Basic or Visual C# and then select Web. Note that one of these options may be located under Other Languages. 4. Select AJAX 1.0-Enabled ASP.NET 2.0 Web Application from the list of Templates in the right pane. 5. Enter a URL for your application in the Location field and click OK. Note: The Web server must have IIS version 6 or later and the .NET Framework installed on it. If you have IIS on your computer, you can specify http://localhost for the server. A new Web Forms project is created at the root of the Web server you specified. In addition, a new Web Forms page called Default.aspx is displayed and a ScriptManager control is placed on the form. The ScriptManger is needed to enable certain features of ASP.NET AJAX such as partial-page rendering, client-script functionality of the Microsoft AJAX Library, and Web-service calls.  Creating an AJAX-Enabled Web Site Project in Visual Studio 2005 To create a Web site project in Visual Studio 2005, complete the following steps: 1. From the File menu in Microsoft Visual Studio .NET, select New Web Site. The New Web Site dialog box opens. 2. Select ASP.NET AJAX-Enabled Web Site from the list of Templates. 3. Enter a URL for your site in the Location field and click OK. Note: The Web server must have IIS version 6 or later and the .NET Framework installed on it. If you have IIS on your computer, you can specify http://localhost for the server. A new Web Forms project is created at the root of the Web server you specified. In addition, a new Web Forms page called Default.aspx is displayed and a ScriptManager control is placed on the form. The ScriptManger is needed to enable certain features of ASP.NET AJAX such as partial-page rendering, client-script functionality of the Microsoft AJAX Library, and Web-service calls.  Creating an AJAX-Enabled Web Application Project in Visual Studio 2005 To create a new Web application project in Visual Studio 2005, complete the following steps. 1. From the File menu in Microsoft Visual Studio 2005, select New Project. The New Project dialog box opens. 19
  25. 25. 2. Under Project Types, choose either Visual Basic Projects or Visual C# Projects. Note that one of these options may be located under Other Languages. 3. Select ASP.NET AJAX-Enabled Web Application from the list of Templates in the right pane. 4. Enter a URL for your application in the Location field and click OK. Note: The Web server must have IIS version 6 or later and the .NET Framework installed on it. If you have IIS on your computer, you can specify http://localhost for the server. A new Web Forms project is created at the root of the Web server you specified. In addition, a new Web Forms page called Default.aspx is displayed and a ScriptManager control is placed on the form. The ScriptManger is needed to enable certain features of ASP.NET AJAX such as partial-page rendering, client-script functionality of the Microsoft AJAX Library, and Web-service calls. Adding the C1GridView Component to a Project When you install ComponentOne Studio for ASP.NET AJAX, the Create a ComponentOne Visual Studio Toolbox Tab check box is checked, by default, in the installation wizard. When you open Visual Studio, you will notice a ComponentOne Studio for ASP.NET AJAX tab containing the ComponentOne controls has automatically been added to the Toolbox. If you decide to uncheck the Create a ComponentOne Visual Studio Toolbox Tab check box during installation, you can manually add ComponentOne controls to the Toolbox at a later time. ComponentOne GridView for ASP.NET AJAX provides the C1GridView control. C1GridView is the component used to generate a table of items that can be selected, edited, deleted and sorted. To use C1GridView, add it to the form or add a reference to the C1.Web.UI.Controls.C1GridView assembly to your project. Manually Adding a C1GridView Component to the Toolbox To add C1GridView to the Visual Studio Toolbox: 1. Open the Visual Studio IDE (Microsoft Development Environment). Make sure the Toolbox is visible (select Toolbox in the View menu, if necessary) and right-click it to open the Toolbox context menu. 2. If you want the C1GridView component to appear on its own tab in the Toolbox, select Add Tab from the context menu and type in the tab name, C1GridView, for example. 3. Right-click the tab where the component is to appear and select Choose Items from the context menu. The Choose Toolbox Items dialog box opens. 4. In the Choose Toolbox Items dialog box, select the .NET Framework Components tab. Sort the list by Namespace (click the Namespace column header) and check the check box for the component belonging to namespace C1.Web.UI.Controls.C1GridView. Adding a C1GridView Component to the Form To add C1GridView to a form: 1. Add it to the Visual Studio Toolbox. 2. Double-click the control or drag it onto your form. Adding a Reference to the Assembly To add a reference to the C1.Web.UI.Controls.C1GridView.2 assembly: 1. Select the Add Reference option from the Project menu of your Web application project. This option is on the Website menu for Web site projects. 20
  26. 26. 2. Select the ComponentOne C1GridView assembly from the list on the .NET tab or browse to find the C1.Web.UI.Controls.2.dll (or C1.Web.UI.Controls.3.dll) file and click OK. 3. Double-click the Default.aspx page to open the code window. At the top of the file, add the following Imports statement (using in C#): Imports C1.Web.UI.Controls.C1GridView Note: This makes the objects defined in the C1GridView assembly visible to the project. See Namespaces (page 17) for more information. Upgrading From WebGrid for ASP.NET If you're currently a user of the C1WebGrid control, you may find GridView for ASP.NET AJAX to both be very familiar and different. While GridView for ASP.NET AJAX includes all the functionality of WebGrid for ASP.NET, some features were added and several object model changes were made to ensure compatibility with the standard Microsoft GridView control. Key Differences  C1GridView is in the C1.Web.UI.Controls.C1GridView namespace.  C1GridView requires that a ScriptManager control be included on the page.  Many C1WebGrid properties, events, classes, and enumerators have been renamed or removed in C1GridView. For example: the Items collection in C1WebGrid has been renamed to Rows in C1GridView. This means that most places where "Item" appears in code will need to be changed to "Row". For details of differences, see Renamed Members (page 21) and Removed Members (page 25). New Features Several new features were added to C1GridView, including Visual Styles (page 47), advanced scrolling, and filtering (page 55). Several types and class members were added to support these new features. For more information, see New Members (page 23). Column Changes Three new column types include: C1CheckBoxField, C1RowHeaderField, and C1ImageField. C1CheckBoxFields can be bound to Boolean data fields for a nicer appearance and easier editing through the use of check boxes. C1ImageField can easily display images from databound URL addresses. The base type C1Column has been removed in C1GridView and replaced with the C1Field class. C1CommandField replaced C1EditCommandColumn. Note that when converting from C1EditCommandColumn to C1CommandField, you will need to set ShowEditButton to True. Renamed Members The tables below note some of the classes and members that were changed, to better enable you to convert your projects to using the C1GridView control. Classes and Enumerators The following Classes and Enumerators in C1WebGrid have been renamed in C1GridView: In C1WebGrid In C1GridView C1GridItem C1GridViewRow C1ListItemType C1GridViewRowType* 21
  27. 27. GridUpdateBinding C1GridViewUpdateBinding C1BaseColumn C1BaseField C1BoundColumn C1BoundField C1ButtonColumn C1ButtonField C1CommandColumn C1CommandField C1Column C1Field C1HyperLinkColumn C1HyperLinkField C1TemplateColumn C1TemplateField C1BaseColumnCollection C1BaseFieldCollection GroupMoveEnum GroupMove GroupPositionEnum GroupPosition OutlineModeEnum OutlineMode RowMergeEnum RowMerge * The C1ListItemType enumerator is commonly used to identify rows in C1WebGrid at runtime. In C1GridView this enumerator has been renamed C1GridViewRowType and has the following differences:  The AlternatingItem, EditItem, and Item members are now all combined in the C1GridViewRowType.DataRow member.  Two new members of C1GridViewRowType are EmptyDataRow and Filter. C1WebGrid Members The following C1WebGrid properties have been renamed in C1GridView: In C1WebGrid In C1GridView CurrentPageIndex PageIndex EditItemIndex EditIndex DataKeyField DataKeyNames PagerStyle-Mode PagerSettings.Mode The following C1WebGrid styles have been renamed in C1GridView: In C1WebGrid In C1GridView AlternatingItemStyle AlternatingRowStyle EditItemStyle EditRowStyle ItemStyle RowStyle 22
  28. 28. SelectedItemStyle SelectedRowStyle The following C1WebGrid events have been renamed in C1GridView: In C1WebGrid In C1GridView CancelingCommand RowCancelingEdit DeletedCommand RowDeleted DeletingCommand RowDeleting EditingCommand RowEditing ItemCommand RowCommand ItemCreated RowCreated ItemDataBound RowDataBound SortedCommand Sorted SortingCommand Sorting UpdatedCommand RowUpdated UpdatingCommand RowUpdating New Members The tables below note some of the classes and members that were added to C1GridView. The new members were primarily added to either enable compatibility with the standard Microsoft GridView control or to support new features such as filtering. New Events Two new events have been added to support the filter bar feature: Event Description Filtered Occurs after filter expression is applied to the underlying DataView's RowFilter property. Filtering Occurs when the preparation for filtering is started but before the C1GridView instance handles the filter operation. New Enumerators Two new enumerators have been added to support the filter bar feature: Enumerator Description FilterMode Gets or sets value indicating whether filtering will be performed automatically or not. FilterOperator Gets or sets filter operator used for filtering. New Properties 23
  29. 29. The following design and run-time properties have been added to C1GridView. Many of these were added to support the standard Microsoft GridView control and were never included in C1WebGrid: Property Description AutoGenerateDeleteButton Gets or sets a value indicating whether a CommandField field column with a Delete button for each data row is automatically added to a C1GridView control. AutoGenerateEditButton Gets or sets a value indicating whether a CommandField field column with an Edit button for each data row is automatically added to a C1GridView control. AutoGenerateFilterButton Gets or sets a value indicating whether a CommandField field column with a Filter button for each data row is automatically added to a C1GridView control. AutoGenerateSelectButton Gets or sets a value indicating whether a CommandField field column with an Select button for each data row is automatically added to a C1GridView control. BottomPagerRow Gets a C1GridViewRow object that represents the bottom pager row in a C1GridView control. C1WebControlsPath Gets or sets the text to render in an HTML caption element in a Caption C1GridView control. This property is provided to make the control more accessible to users of assistive technology devices. CaptionAlign Gets or sets the horizontal or vertical position of the HTML caption element in a C1GridView control. This property is provided to make the control more accessible to users of assistive technology devices. EmbeddedVisualStyles Returns string array with embedded Visual Styles names. (Overrides C1ThemeableCompositeDataBoundControlEmbeddedVisualSt yles().) Gets or sets the text to display in the empty data row rendered EmptyDataText when a C1GridView control is bound to a data source that does not contain any records. FilterMode Gets or sets value indicating whether filtering will be performed automatically or not. FooterRow Gets a C1GridViewRow object that represents the footer row in a C1GridView control. HeaderRow Gets a C1GridViewRow object that represents the header row in a C1GridView control. HeaderRows Gets an array of C1GridViewRow objects that represents the header rows in a C1GridView control. RowHeaderColumn Gets or sets the name of the column to use as the column header for the C1GridView control. This property is provided to make the control more accessible to users of assistive technology devices. SelectedDataKey Gets the DataKey object that contains the data key value for the selected row in a C1GridView control. SelectedValue Gets the data key value of the selected row in a C1GridView control. ShowFilter Gets or sets value indicating whether filter row is visible or not. TopPagerRow Gets a C1GridViewRow object that represents the top pager row in a 24
  30. 30. C1GridView control. UseAccessibleHeader Gets or sets a value indicating whether a C1GridView control renders its header in an accessible format. This property is provided to make the control more accessible to users of assistive technology devices. UseEmbeddedVisualStyles VisualStyle Gets or sets the visual style name used by the control. (Overrides C1ThemeableCompositeDataBoundControlVisualStyle().) VisualStylePath Gets or sets the path to the visual style folder. (Overrides C1ThemeableCompositeDataBoundControlVisualStylePath().) New Styles and Settings The following styles and settings are now available in C1GridView: Property Description EmptyDataRowStyle Gets a reference to the TableItemStyle object that enables you to set the appearance of the empty data row rendered when a C1GridView control is bound to a data source that does not contain any records. FilterStyle Gets a reference to the TableItemStyle object that enables you to set the appearance of the filter row in a C1GridView control. PagerSettings* Gets a reference to the C1GridViewPagerSettings object that enables you to set the properties of the pager buttons in a C1GridView control. ResizeSettings Gets the ResizeSettings object that defines the resizing behavior of the columns on client-side. RowHeader Gets a C1RowHeaderField object that represents the row header in a C1GridView control. ScrollSettings Gets the scroll setting for the C1GridView control. * C1WebGrid's PagerStyle class has now been broken up into C1GridView's PagerStyle and the new PagerSettings. The commonly used property, Mode, is now found under PagerSettings and contains the following differences:  Support for two new modes: NextPreviousFirstLast and NumericFirstLast.  Support for custom navigation link images. Four new properties have been added for this feature: FirstPageImageUrl, LastPageImageUrl, NextPageImageUrl, and PreviousPageImageUrl. Removed Members The following list notes some of the properties that were removed to better enable you to convert your projects to using the C1GridView control:  BackColor  BorderColor  BorderStyle  BorderWidth 25
  31. 31.  Font  ForeColor  HScrollbarStyle*  ImageGroup+  ImageSortAscending+  ImageSortDescending+  ImageUngroup+  VScrollBarStyle* * HScrollBarStyle and VScrollBarStyle were used in C1WebGrid to set scrollbar settings. C1GridView has a new ScrollSettings class which handles everything C1WebGrid could do and more. To simply turn scroll bars on set the ScrollSettings.ScrollMode property to ScrollBar. To specify orientation set ScrollSettings.ScrollOrientation to Both, Horizontal, or Vertical. + The Image file paths required for C1WebGrid are no longer required for C1GridView as the images are built-in by default and can be customized using a CSS theme. The remaining properties that were removed are all styling properties that should now be set on a deeper level in the control. For example, to set a background color you could set the RowStyle.BackColor property. Key Features In addition to the standard Microsoft GridView features, ComponentOne GridView for ASP.NET AJAX includes advanced features that enable developers to build intuitive, professional-looking Web applications quickly and easily:  Built-in AJAX Support Reload your grid on demand with C1GridView's built-in AJAX support. With GridView for ASP.NET AJAX, editing, paging, and sorting, and more can be handled through callbacks with partial page refreshing. For more information, see Using AJAX (page 57) and Updating the Grid with AJAX (page 92).  Customized Grid Formatting Intuitive formatting allows the developer to automatically customize any grid including creating columns, displaying borders and gridlines, allowing editing within the grid, customizing sorting data and much more.  Built-in Visual Styles Style your grid application with built-in Office 2007 and Vista visual style themes and the ability to completely customize your own theme. See Visual Styles (page 47) for more information.  CSS Styling GridView for ASP.NET AJAX includes CSS supported styling so that you can use cascading style sheets to easily style the C1GridView control to match the design of your current Web site.  Microsoft GridView Compatibility GridView for ASP.NET AJAX is completely compatible with the standard Microsoft GridView control so that you can easily convert your existing projects. 26
  32. 32.  Customized Paging You can determine how to display C1GridView data on multiple pages and how the pagers appear. Pagers can be displayed numerically, as Next and Previous buttons or you can create your own style. See Paging (page 56) and Creating a Pageable Grid (page 87) for more information.  Outlook-style grid, run-time features You can implement interactive run-time features such as Outlook-style grouping, which allows you to drag and drop a column to group on that column. For an example, see Adding Outlook-Style Grouping (page 86).  Grouping with Aggregates You can group data, create trees with expandable and collapsible nodes, and automatically calculate data aggregates to be placed in the group header and footer rows. See Grouping (page 51) and Using Aggregates and Grouping (page 84) for more information.  Built-In Filtering C1GridView supports a built-in, data-entry row below the column headers for custom end-user operations such as searching and filtering records. For more information, see Filtering (page 55).  Row Merging The RowMerge property allows you to merge rows containing identical text. This feature can be used to create a neat and well-organized grid. See Merging Rows (page 84) for an example.  ValueLists By creating a ValueList dictionary and setting the ValueList property, you can replace the text appearing in a grid with your own. For an example, see Customizing Columns Using ValueLists (page 66).  Client-Side Scrolling The ScrollSettings property of C1GridView allows you to create a client-side grid that supports both horizontal and vertical scrolling. You can determine whether your columns and rows are fixed to the grid when it is scrolled using the Fixed property of the C1BaseField and the C1GridViewRow classes, respectively. See Using Client-Side Scrolling (page 89) for more information.  Advanced Scrolling C1GridView supports advanced scrolling features, such as buttons and automatic scrolling when the user hovers near the edge of the grid, as well as standard scroll bars in either direction.  Browser Support GridView for ASP.NET AJAX includes support for Internet Explorer (6.0 or later), Firefox (2 or later), and Safari Web browsers.  Template Support You can easily create timesaving grid templates with the same look and feel that can be used throughout a project.  Client-Side Script GridView for ASP.NET AJAX's client side functionality is provided by JavaScript included in the product.  C1Input for ASP.NET AJAX Integration Attach ComponentOne Input for ASP.NET AJAX controls to Edit Templates to enhance data entry.  Column Control Integration 27
  33. 33. Easily display check boxes, list boxes, buttons, and images in a column. See Adding Controls to a Column (page 73) for more information.  XHTML Compliant C1GridView provides complete XHTML compliance. The output that is generated is fully XHTML 1.1 compliant.  Samples and Task-Based Help GridView for ASP.NET AJAX includes sample projects and task-based help to give you a better understanding of how GridView for ASP.NET AJAX works.  The sample projects (page 59) demonstrate the techniques for using groups and aggregates, customizing columns and pagers, and sorting and editing data.  The task-based help topics walk you step-by-step through specific tasks, such as binding C1GridView to a data source, merging rows, and adding a column. For additional information, see GridView for ASP.NET AJAX Task-Based Help (page 59). Try running the projects, examining the code, and experimenting with your own modifications. Running the samples and using the task-based help is the best and quickest way to realize the full potential of the C1GridView control. You'll find that GridView for ASP.NET AJAX is very easy to use, and it enables you to create powerful applications. 28

×