Telerik blogs
In a series of posts I will walk through some of the new features for RadGrid for ASP.NET AJAX Q1 2008. Here is the first part:

- Global ItemTemplate for GridTableView - (CardView):

Using ItemTemplate you have ability to replace all GridDataItem GridEditableColumns cells with single cell.

Example:
<telerik:RadGrid ID="RadGrid1" runat="server"
 <MasterTableView> 
  <ItemTemplate> 
    Master 
  </ItemTemplate> 
  <DetailTables> 
    <telerik:GridTableView runat="server"
      <ItemTemplate> 
        Detail 
      </ItemTemplate> 
    </telerik:GridTableView> 
  </DetailTables> 
 </MasterTableView> 
</telerik:RadGrid> 


- NestedViewTemplate (detail table template):


Now you can design and present master/detail data in more flexible way using DetailsView, RadChart or any other ASP.NET component/plain html.

Example:
<telerik:RadGrid ID="RadGrid1" runat="server"
 <MasterTableView> 
   <NestedViewTemplate> 
       Details for:<%# Eval("CustomerID") %> 
   </NestedViewTemplate> 
   <DetailTables> 
      ... 
 
 


- Footer aggregates:


You can specify now Aggregate property with following values: Sum, Min, Max, Last, First, Count, Avg & Custom for every GridBoundColumn and the grid will calculate these aggregates if ShowFooter is set to true. In case of Custom aggregate the grid will raise event OnCustomAggregate where you can set desired result using e.Result.

RadGrid will calculate aggregates by default on the entire data source and will respect filtering.

Example:
... 
<telerik:GridBoundColumn Aggregate="Count" DataField="CustomerID" DataType="System.String" 
  HeaderText="CustomerID" SortExpression="CustomerID" UniqueName="CustomerID"
</telerik:GridBoundColumn> 
... 


- Group footers & aggregates:


You can turn on group footers using ShowGroupFooter property of GridTableView and the grid will calculate automatically all columns aggregates (if defined) for the current group.


- Calculated columns:


Using Expression and DataFields properties of GridCalucatedColumn you can create easily various calculations plus you can sort, group and filter these columns exactly in the same way as normal GridBoundColumn.

Example:
<telerik:GridCalculatedColumn HeaderText="Total Price" UniqueName="TotalPrice"   
  DataType="System.Double"  
DataFields="UnitPrice, UnitsInStock" Expression="{0}*{1}" Aggregate="Sum" /> 
 

That's all for now!

Enjoy :-)

About the Author

Vladimir Enchev

is Director of Engineering, Native Mobile UI & Frameworks

Comments

Comments are disabled in preview mode.