Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Reporting
  [Expand]Chart Control
  [Collapse]Grid View
   [Expand]Product Information
    Getting Started
   [Expand]Fundamentals
   [Collapse]Concepts
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Expand]Data Editing
    [Expand]Data Shaping and Manipulation
    [Expand]Data Formatting
    [Expand]Master-Detail Relationship
     Appearance Customization
     Adaptivity
     Save and Restore Layout
    [Collapse]Templates
      Creating Templates
      Template Replacements
      Grid Elements that Support Templates
      Accessing Controls Contained within Templates
    [Expand]Export
     Toolbars
    [Expand]ASPxGridLookup
    ASPxGridView Designer
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
   [Expand]ASPxGridView - Animated Images
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Creating Templates

Templates can be created using the Template Designer that is provided by the ASPxGridView control or directly in the .aspx file.

Expanded Using the Template Designer

The Template Designer allows you arrange templates. For example, you can drag a Web control from the toolbox onto the template currently being edited.

To invoke the Template Designer, click the Edit Templates task and then select the template. The designer can also be invoked using the ASPxGridView's context menu. Select the Edit Template menu item and select the template you want to edit. As a result, the ASPxGridView will be displayed in template-editing mode.

When finished, click the End Template Editing task.

Expanded Using ASP.NET Syntax

Templates are created as nested tags. To create a template using ASP.NET syntax, do the following:

  • In the .aspx file, insert an element inside ASPxGridView (or inside a particular template column) to identify which template you are creating.

  • Add the template's contents (HTML text or other Web controls). Include property and data-binding values for the embedded controls using standard syntax.

    The image below shows how to bind a label to a field.

  • Repeat steps 1 and 2 to create other templates.

When creating a template for the Edit Form or Pager, you can use the ASPxGridViewTemplateReplacement control, which is designed to display the regular contents (edit cells, Update and Cancel buttons, pager) within a template. Use the ASPxGridViewTemplateReplacement.ReplacementType property to specify which controls are displayed by the control. To learn more, see the Template Replacements topic.

For an example, see Edit Form Template in the ASPxGridView demo.

Is this topic helpful?​​​​​​​