Knowledgebase: RadarCube ASP.NET MSAS
RiaGridView - Getting started
Posted by - NA - on 16 March 2009 08:54 AM

Placing the RiaGridView Control on the Web Page

  1. Place the ScriptManager control on the web page.
  2. From the RadarSoft Essential Pack tab in the Toolbox select the RiaGridView control and drag it to your web page.

Another way is to convert the GridView control (that already is on your page) into RiaGridView: simply substitute the “asp” tag prefix for “rs” and the “GridView” tag name for “RiaGridView” and add the following line after the “<%@ Page … %>” line of your apsx page:

<%@ Register assembly="RadarSoft.Web.Essential.Grid" namespace="RadarSoft.Web.Essential.Grid" tagprefix="rs" %>

Functions of the RiaGridView Control

The RiaGridView allows displaying data from the data source on a web page in the form of a table, as well as selecting, sorting and editing them. It is based on both ASP.NET and Silverlight technologies, by introducing the Silverlight application into GridView, an ASP.NET component. This allows using the capabilities of the Visual Studio environment for tuning the settings of the RiaGridView control.

Functional Capabilities of GridView realized in the RiaGridView Control:

  • Binding the control elements to the data source, for instance, AccessDataSource.
  • In-built ascending and descending sorting.
  • In-built editing and deleting data.
  • In-built paging data.
  • In-built single and multiple cell and rows selection.
  • Program access to an RiaGridView object model for dynamic setting of values, handling events, etc.
  • Multiple key fields.
  • Multiple key fields for columns of hyperlinks.

Functional Capabilities of GridView not realized in the RiaGridView Control:

  • Adjustable view with an access to themes and styles.

New Functional Capabilities of the RiaGridView Control:

  • Drag-n-dropping of the columns.
  • In-built cell selection, as well as multiple selections of cells and rows.
  • Inserting new records to the database.

Column Fields

Each column in the RiaGridView control is represented by a DataControlField object. You can manipulate the display of the column fields in RiaGridView control only manually, since the AutoGenerateColumns property is not realized. You can define your own collection of column fields. Different types of column fields define their characteristics in the control.

Types of Column Fields, Used in the RiaGridView Control:


Displays the value of a field in the database. By default, this is the standard column type for the RiaGridView control.


Displays a button for each record in the RiaGridView control. This allows you to create a column of custom control elements – buttons.


Displays a flag for each record in the RiaGridView control. This column field is typically used for displaying fields with logical values.


Displays the value of a field in the database as a hyperlink. It allows you to bind a field to an URL-address of a hyperlink.


Displays an image for each record in the RiaGridView control.

The CommandField and TemplateField column fields are not used in the RiaGridView. But the functional capabilities of the CommandField type are provided by the first column of the RiaGridView control table.

Setting the RiaGridView Control

The basic settings of the RiaGridView control, such as the declarative definition of the column field collection, binding to data and assigning the properties’ values to provide the functional capabilities, are tuned the same way as in GridView.

The properties of the GridView control that are not available in the RiaGridView are not displayed in the properties’ window.

The RiaGridView control realizes the RowCommand event that is executed upon pressing any of the record control buttons (‘add’ or ‘delete’).


The example code demonstrates using the RiaGridView control for displaying the values of the Customers table from Microsoft Access database from the OLAPDemo3.mdb file. The values are extracted with the AccessDataSource control.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register assembly="RadarSoft.Essential.Web" namespace="RadarSoft.Essential.Web" tagprefix="rs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        <br />
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            SelectCommand="SELECT CustomerID, City, ImageField, BoolField, HyperLinkField FROM CustomersCoppy" 
            DeleteCommand="DELETE FROM [CustomersCoppy] WHERE CustomerID = ?" 
            InsertCommand="INSERT INTO CustomersCoppy(CustomerID, City, Boolfield, ImageField, 
            HyperLinkField) VALUES (@CustomerID, @City, @Boolfield, @ImageField, @HyperLinkField)" 
            UpdateCommand="UPDATE CustomersCoppy SET City = ?, ImageField = ?, BoolField = ?,
             HyperLinkField = ? WHERE (CustomerID = ?)">
        <br />
        <rs:RiaGridView ID="RiaGridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" BackColor="#CCFFFF" 
            BackImageUrl="~/Images/eval.png" CellPadding="0" 
            DataKeyNames="CustomerID" DataSourceID="AccessDataSource1"          
            Height="300px" IsPagingEnable="True" IsSortEnable="True" 
            ShowFooter="True" SortType="ASC" 
            UseAccessibleHeader="False" Width="600px" AccessKey="" Caption="" 
            CssClass="" EnableViewState="False" GridLines="None" SelectedIndex="0" 
            SkinID="" ToolTip="">
            <PagerSettings Mode="NumericFirstLast" />
                <asp:BoundField ApplyFormatInEditMode="True" DataField="CustomerID" 
                    FooterText="CustomerID" HeaderText="CustomerID" ReadOnly="True" 
                    SortExpression="CustomerID" />
                <asp:BoundField DataField="City" HeaderText="City" HtmlEncode="False" 
                    HtmlEncodeFormatString="False" SortExpression="City" />
                <asp:CheckBoxField DataField="BoolField" HeaderText="BoolField" 
                    SortExpression="BoolField" />
                <asp:ImageField AlternateText="alternateText" DataImageUrlField="ImageField" 
                    HeaderText="ImageColumn" NullDisplayText="Empty" SortExpression="City">
                <asp:HyperLinkField DataNavigateUrlFields="HyperLinkField" 
                    DataTextField="City" DataTextFormatString="LinkName: {0}" 
                    HeaderText="HeaderLink" SortExpression="City" Target="_blank" 
                    Text="Link" />
                <asp:ButtonField ButtonType="Button" CommandName="sort" DataTextField="City" 
                    DataTextFormatString="Button: {0}" HeaderText="ButtonField" 
                    ImageUrl="~/Images/Star.png" SortExpression="CustomerID" Text="Button" />
        <br />
(609 vote(s))
This article was helpful
This article was not helpful

Help Desk Software by Kayako Resolve