Wednesday 30 November 2011

cookies concept in asp.net

o write a cookie by creating an instance of the HttpCookie object

  1. Create an object of type HttpCookie and assign it a name.
  2. Assign values to cookie's subkeys and set any cookie properties.
  3. Add the cookie to the Cookies collection.
    The following code example shows an instance of the HttpCookie object named myCookie, which represents a cookie named UserSettings.
    HttpCookie myCookie = new HttpCookie("UserSettings");
    myCookie["Font"] = "Arial";
    myCookie["Color"] = "Blue";
    myCookie.Expires = DateTime.Now.AddDays(1d);
    Response.Cookies.Add(myCookie);
    Read a string from the Cookies collection using the cookie's name as the key.
     
    if (Request.Cookies["UserSettings"] != null)
    {
        string userSettings;
        if (Request.Cookies["UserSettings"]["Font"] != null)
        { userSettings = Request.Cookies["UserSettings"]["Font"]; }
    }
     

Wednesday 16 November 2011

girdview values delete by combo box in asp.net

HTML clipboard
asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
            DataSourceID="SqlDataSource1" AllowPaging ="true" DataKeyNames ="Roll">
            <Columns>
                <asp:TemplateField HeaderText="ROLL">
                    <ItemTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" Text='<%# Eval("Roll") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
            </Columns>
        </asp:GridView>
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:goelConnectionString %>"
            SelectCommand="SELECT * FROM [stu]"></asp:SqlDataSource>
  
    </div>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
        style="width: 74px" Text="DELETE" />
    </form>
 
 
protected void Button1_Click(object sender, EventArgs e)
{

        bool atLeastOneRowDeleted = false;
     foreach (GridViewRow row in GridView1.Rows)

    CheckBox cb = (CheckBox)row.FindControl("CheckBox1");
    if (cb != null && cb.Checked)
{
        atLeastOneRowDeleted = true;
        // First, get the ProductID for the selected row
    int productID = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value); // "Delete" the row
   

    SqlConnection sq = new SqlConnection("data source=MCQL;initial catalog=goel;user id=sa;password=lko.123");
    sq.Open();
    SqlCommand cmd = new SqlCommand("delete from stu where Roll='" + productID.ToString() + "'", sq);
    cmd.ExecuteNonQuery();
    Label1.Text += string.Format("This would have deleted ProductID {0}<br />", productID);
}
        // Show the Label if at least one row was deleted...
Label1 .Visible = atLeastOneRowDeleted;
   
    }

checkbox added in gridview

. right click on your DataGrid -->Property Builder -->Columns --> Template Column --> Apply --> Ok.
2. Right click again --> EidtTemplate --> choose Column you add --> drag CheckBox control from Toolbox and drop it in ItemTemplate field and if you need CheckBox in edit mode put another CheckBox control in EditItemTemplate field --> End Template Editing.

Code on the button:

  1. private void btn_Delete_Click(object sender, System.EventArgs e)
  2. {
  3. for(int i=0;i<dg_EditProduct.Items.Count;i++)
  4. {
  5. CheckBox chk = new CheckBox();
  6. chk = (CheckBox)dg_EditProduct.Items[i].FindControl("chk_Delete");
  7. if(chk.Checked)
  8. {
  9. DataTable myTable;
  10. myTable=(DataTable)Session["ProductTable"];
  11. int ID_Delete = Convert.ToInt32( myTable.Rows[i]["ProductID"]);
  12. Str_Conn = ConfigurationSettings.AppSettings["Fashion"];
  13. MyConn = new SqlConnection(Str_Conn);
  14. //Command to delete Product
  15. // SqlCommand cmd_DeleteProduct = new SqlCommand("dbo.DeleteProduct",MyConn);
  16. SqlCommand cmd_DeleteProduct = new SqlCommand("DeleteProduct",MyConn);
  17. cmd_DeleteProduct.CommandType = CommandType.StoredProcedure;
  18. SqlParameter ProductID_Delete = cmd_DeleteProduct.Parameters.Add("@ProductID",SqlDbType.Int);
  19. ProductID_Delete.Value = ID_Delete ;
  20. MyConn.Open();
  21. dg_EditProduct.DataSource = myTable;
  22. cmd_DeleteProduct.ExecuteNonQuery();
  23. MyConn.Close();
  24. }
  25. }
  26. BindData(); // it is the function you use to bind data to datagrid on page load
  27. }

Monday 14 November 2011

GRID VIEW HANDLING CONCEPT


Your project or website must be ASP.NET AJAX enabled website. Because we are going to add the GridView in an UpdatePanel. So your GridView control will be look smart without unnecessary postbacks. You need to create a Customer Table with 6 columns for Customer Code[Code], Name[Name], Gender[Gender], City[City], State[State] and Customer Type[Type], with your desired data types. Then create a class file in your App_Code folder and create a Default.aspx along with code-behind file Default.aspx.cs.

Step 1. Create Class File ‘CustomersCls.cs’

We need to create a class file to do database manipulations such as select, insert, delete and update data in the Customer Table. So we add a class file as ‘CustomersCls.cs’ in App_Code section. Let us write five methods in the class file as follows
public void Insert(string CustomerName, string Gender, string City, string State, string CustomerType)
{
    // Write your own Insert statement blocks
}

public DataTable Fetch()
{
  // Write your own Fetch statement blocks, this method should return a DataTable
}

public DataTable FetchCustomerType()
{
  // Write your own Fetch statement blocks to fetch Customer Type from its master table and this method should return a DataTable
}

public void Update(int CustomerCode, string CustomerName, string Gender, string City,  string CustomerType)
{
  // Write your own Update statement blocks.
}

public void Delete(int CustomerCode)
{
  // Write your own Delete statement blocks.
}
Step 2: Make Design File ‘Default.aspx’

In the Default.aspx page, add an UpdatePanel control. Inside the UpdatePanel, add a GridView, set AutoGenerateColumns as False. Change the ShowFooter Flag to True and set the DataKeyNames your column name for Customer Code and Customer Type, in our case it is Code and Type. Then click on the Smart Navigation Tag of the GridView control, choose Add New Column and add 5 BoundField columns with DataField values as Name, Gender, City, State and Type, plus 2 CommandField columns with one for Edit/Update and another for Delete functions. Now your GridView control is ready. But as first step, we need to add some new records into the database. For that we need to place the controls in the Footer row. So we have to convert all these BoundField columns as TemplateField columns. To do this again, click on the Smart Navigation Tag on the GridView choose Edit Columns, the Field’s property window will open. Select column by column from Name to Customer Type, include also Edit column, and select ‘Convert this field into a TemplateField’. Now all the BoundField columns will be converted to TemplateField columns except the Delete column.
Column[0] – Name

Right click on the GridView control, select Edit Template, choose column[0] – Name, you can view a label placed in the ItemTemplate section and a TextBox placed in the EditItemTemplate section. Add another Texbox in the FooterTemplate section and name it as txtNewName.

Column[1] - Gender

Now again select Edit Template, choose column[1] - Gender, replace the TextBox with a DropDownList, name it as cmbGender, add Male and Female as their ListItem values. On the Edit DataBindings of the cmbGender, add Eval("Gender") to its selectedvalue. Add another DropDownList in the FooterTemplate section and name it as cmbNewGender.

Column[2] –City & Column[3] - State

Add Texboxes in both column’s FooterTemplate section and name it as txtNewCity and txtNewState respectively.

Column[4] - Type

In this column’s EditItemTemplate section, replace the TextBox with a DropDownList, name it as cmbType. Also add another DropDownList in the FooterTemplate section and name it as cmbNewType. Both these DropDownList’s we are going to fill with dynamic data from database. So specify both DropDownList’s DataTextField and DataValueField as Type.

Column[5] - Edit

Just add a link button into the FooterTemplate section, specify its CommandName property as ‘AddNew’.

For your persual, we have provided the complete source code of the GridView control below. The State column in our sample is read-only. So you cannot find TextBox for that column in the EditItemTemplate section.
http://www.aspdotnetcodes.com/Images/collapse.jpgClick here to view Source Code of the GridView Control [Show full code..]
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Code, Type" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowDataBound="GridView1_RowDataBound" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowCommand="GridView1_RowCommand" ShowFooter="True" OnRowDeleting="GridView1_RowDeleting">
<Columns>

<asp:TemplateField HeaderText="Name" SortExpression="Name"> <EditItemTemplate>
  <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
  <asp:TextBox ID="txtNewName" runat="server"></asp:TextBox> </FooterTemplate>
<ItemTemplate>
  <asp:Label ID="Label2" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Gender">
<EditItemTemplate>
  <asp:DropDownList ID="cmbGender" runat="server" SelectedValue='<%# Eval("Gender") %>'>
    <asp:ListItem Value="Male" Text="Male"></asp:ListItem>
    <asp:ListItem Value="Female" Text="Female"></asp:ListItem>
  </asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
  <asp:Label ID="Label2" runat="server" Text='<%# Eval("Gender") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
  <asp:DropDownList ID="cmbNewGender" runat="server" >
    <asp:ListItem Selected="True" Text="Male" Value="Male"></asp:ListItem>
    <asp:ListItem Text="Female" Value="Female"></asp:ListItem> </asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="City">
<EditItemTemplate>
  <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
  <asp:TextBox ID="txtNewCity" runat="server" ></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
  <asp:Label ID="Label3" runat="server" Text='<%# Bind("City") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="State" SortExpression="State">
<EditItemTemplate>
  <asp:Label ID="Label1" runat="server" Text='<%# Eval("State") %>'></asp:Label>
</EditItemTemplate>
<FooterTemplate>
  <asp:TextBox ID="txtNewState" runat="server" ></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
  <asp:Label ID="Label4" runat="server" Text='<%# Bind("State") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Type">
<EditItemTemplate>
  <asp:DropDownList ID="cmbType" runat="server" DataTextField="Type" DataValueField="Type"> </asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
  <asp:Label ID="Label5" runat="server" Text='<%# Eval("Type") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
  <asp:DropDownList ID="cmbNewType" runat="server" DataTextField="Type" DataValueField="Type"> </asp:DropDownList>
</FooterTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Edit" ShowHeader="False">
<EditItemTemplate>
  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton>
  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
</EditItemTemplate>
<FooterTemplate>
  <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="AddNew" Text="Add New"></asp:LinkButton>
</FooterTemplate>
<ItemTemplate>
  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" />

</Columns>
</asp:GridView>


Step 3: Make Code-behind File ‘Default.aspx.cs’

Now we are going to do the code-behind part of this page. Les us explain you event by event coding on each methods. In the code-behind page, create an instance for the Customer class as follows
CustomersCls customer=new CustomersCls();

Then create a private method 'FillCustomerInGrid' to retrieve the existing customer list from the database and bind it to the GridView. The CustomersCls class’s Fetch() method is used and it returns the data to a DataTable. On first stage it will return empty rows. So you cannot see any header, data or even footer rows of the GridView control. You can only see an empty space or you see only the EmptyDataText. So you cannot add any new data from the footer row.
private void FillCustomerInGrid()
{
   DataTable dtCustomer= customer.Fetch();

 if (dtCustomer.Rows.Count>0)
 {
    GridView1.DataSource = dtCustomer;
    GridView1.DataBind();
 }
 else
 {
      dtCustomer.Rows.Add(dtCustomer.NewRow());
      GridView1.DataSource = dtCustomer;
      GridView1.DataBind();

      int TotalColumns = GridView1.Rows[0].Cells.Count;
      GridView1.Rows[0].Cells.Clear();
      GridView1.Rows[0].Cells.Add(new TableCell());
      GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns;
      GridView1.Rows[0].Cells[0].Text = "No Record Found";
  }
}

In this article, we have provided a workaround to fix this problem. Closely look at the method FillCustomerInGrid, there is a conditional statement to check the rows exists in DataTable or not. Now go to the else part of the if statement, see the block of code we provided there. Simply we have added an empty row to the DataTable. Then bind it to the GridView control. To give a professional look to the GridView control, we do little bit more by providing ColumnSpan and set a Text as "No Record Found", this text will be displayed if the GridView is empty without any rows and you can see both the Header and Footer of the GridView control.

Initialize GridView control

In the page load event, we have to call this FillCustomerInGrid method as follows,
protected void Page_Load(object sender, EventArgs e)
{
  If (!IsPostBack)
  {
     FillCustomerInGrid();
   }
}

Fill DropDownList in GridView with dynamic values

In column[4] - Type, there are two DropDownList controls, one in the EditItemTemplate section (cmbType) and another in FooterTemplate (cmbNewType). We have to fill both these DropDownList controls with some dynamic data. If you look at our CustomersCls class, we have a separate method called FetchCustomerType. In the RowDataBound event of the GridView control insert the following code.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
   DropDownList cmbType = (DropDownList)e.Row.FindControl("cmbType");

  if (cmbType != null)
  {
    cmbType.DataSource = customer.FetchCustomerType();
    cmbType.DataBind();
    cmbType.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values[1].ToString();
   }
 }

if (e.Row.RowType == DataControlRowType.Footer)
{
    DropDownList cmbNewType = (DropDownList)e.Row.FindControl("cmbNewType");
    cmbNewType.DataSource = customer.FetchCustomerType();
    cmbNewType.DataBind();
 }

}


Previously in this article, we have set the DataKeyNames values as Code, Type. If you see in the above code, we use one of the DataKeyNames value as the SelectedValue for the cmbType control, this is to retain the value of the cmbType in EditMode. The index value of Code is 0 and Type is 1. So we use as follows
cmbType.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values[1].ToString();

So far we have initialized the GridView control with the datatable and also make some values to be filled in the Footer DropDownList cmbNewType. Run the application, you can see the GridView only with the Footer row and data in the cmbNewType control. Let us start to code for adding new records into the database when we click ‘Add New’ linkbutton.

Add New Records from GridView control

Create an event for the GridView’s RowCommand and add the following code in it.
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
  if (e.CommandName.Equals("AddNew"))
  {
   TextBox txtNewName=(TextBox)GridView1.FooterRow.FindControl("txtNewName");
   DropDownList cmbNewGender = (DropDownList)GridView1.FooterRow.FindControl("cmbNewGender");
   TextBox txtNewCity = (TextBox)GridView1.FooterRow.FindControl("txtNewCity");
   TextBox txtNewState = (TextBox)GridView1.FooterRow.FindControl("txtNewState");
   DropDownList cmbNewType = (DropDownList)GridView1.FooterRow.FindControl("cmbNewType");

   customer.Insert(txtNewName.Text, cmbNewGender.SelectedValue, txtNewCity.Text, txtNewState.Text, cmbNewType.SelectedValue) ;
      FillCustomerInGrid();
  }
}

In the above code, we are declaring and finding the controls in the GridView’s footer section and use the CustomersCls class insert method to add the new data into the database. Then we are calling the FillCustomerInGrid method to fill the GridView control with the newly inserted values. Now save everything and run your application. Put some test data in the Textboxes and select some values in the DropDownLists and click on the Add New linkbutton. You can see data inserted into the database and listed in the GridView control.
Edit and Update in GridView

In the RowEditing event of the GridView, add the following lines of code. This will switch a specific row of the GridView to Edit Mode.

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
  GridView1.EditIndex = e.NewEditIndex;
  FillCustomerInGrid();
}

After the GridView swithes to Edit Mode, you can view the TextBoxes and DropDownlList controls along with Update and Cancel linkbuttons in the Edit mode. To cancel this action, add the following two lines of code in the GridView’s RowCancelingEdit event.
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
  GridView1.EditIndex = -1;
   FillCustomerInGrid();
}
You can update the data to the customer table, by adding the following lines of code in the GridView’s RowUpdating event.
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
  TextBox txtName = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtName");
  DropDownList cmbGender = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("cmbGender");
  TextBox txtCity = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtCity");
  DropDownList cmbType = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("cmbType");

 customer.Update(GridView1.DataKeys[e.RowIndex].Values[0].ToString(),txtName.Text, cmbGender.SelectedValue,txtCity.Text, cmbType.SelectedValue);
  GridView1.EditIndex = -1;
  FillCustomerInGrid();
}

GRID VIEW DATA WITH SILVERLIGHT


GridView for Silverlight

Overview

GridView
RadGridView is the ultimate Silverlight grid control that features unrivalled performance through LINQ-based data engine, remarkably flexible hierarchy model, advanced features such as Excel-like filtering, row details, totals, export to Word/Excel/CSV and many more. And as good looks count, we’ve created a truly lookless Silverlight Grid that can be easily customized to blend perfectly into your applications. See a detailed features comparison of Telerik RadGridView and Microsoft Data Grid.

Features

  • LINQ-Based Data Engine and Native UI Virtualization

    Telerik Silverlight Grid handles millions of records without affecting the user experience. The grid utilizes horizontal and vertical UI virtualization and introduces container recycling for further improvement of speed and memory footprint, especially when bound to large data sets. The UI virtualization technique ensures that the grid creates only the needed containers (rows/cells) which are shown in the viewport of the grid. The container recycling pushes further the speed of scrolling horizontally and vertically. This feature enables RadGridView to reuse the existing containers over and over for different data items, instead of creating new ones. These techniques combined with our outstanding LINQ-based data engine guarantee the exceptional fast performance of Telerik’s RadGridView.

    The example below demonstrates how thanks to the content recycling, performance is unhurt even when the Grid has 50 million data items in use.

    Get Microsoft Silverlight
    Top
  • Quick Responsiveness

    Additionally, RadGridView's advanced UI virtualization enables exceptional responsiveness even when working with huge data sets.  Scrolling through 1 billion cells is easy, check out this example.
    Top
  • Powerful Databinding

    Databinding with RadGridView is as simple as setting a single property. The binding sources the Silverlight grid supports include:
    • .NET object
    • ADO.NET data services
    Top
  • Support for .NET RIA Services

    Telerik Grid for Silverlight provides support for .NET RIA Services. It now can handle an enormous amount of records server-side in no time. All data operations are executed on the server, which results in speedier sorting, filtering and paging. Telerik Silverlight Grid can be directly bound to a RIA Service through its ItemSource property, or to a Silverlight DomainDataSource control. Either way, no coding is required, as both approaches allow you to declaratively set the RIA Service.

    See an example showing how to bind RadGridView completely codelessy to RIA Services using DomainDataSource
    Top
  • Built-in Paging UI

    It provides you with a navigation interface to page through your data quickly. The pager control itself can be used as a standalone component in order to provide paged data source to other data-bound controls.





    See demo

  • Direct Data Operations

    With Telerik Silverlight Grid data operations (sorting, grouping, filtering) work directly with your data objects. In a common scenario when a Silverlight grid is performing data operations, you need to create your own collection view. With Telerik Silverlight grid there is no requirement for wrapping your data in collection views to do sorting, grouping and filtering.
    Top
  • Asynchronous Databinding

    To provide better user experience Telerik Silverlight Grid allows asynchronous databinding, which means that the application is responsive even while a large dataset is being loaded. A background Thread is used to load the data asynchronously without blocking the main application flow.
    Top
  • Data Source Updates

    To achieve better testability and loose coupling in your code it may be more convenient to manipulate data in the original data source instead of using the RadGridView API.  Telerik Silverlight Grid supports that scenario by listening to data source collection change events and reflecting those changes in its visual representation.
    Top
  • RadCompression Module

    RadCompression is an HttpModule allowing you to compress the entire Web Service traffic in a codeless manner resulting in less traffic and faster page load. RadCompression intercepts the bits that the server is sending back to a browser (or Silverlight-client, for that matter) and compresses them. Once the compressed bits reach the browser, standard browser technology takes-over and decompresses the response so your application can work with it normally. It is extremely useful in shared hosting environments, where the users usually don’t have the ability to enable the integrated compression of IIS.

    Learn how to compress the response from ADO.NET DataServices in Silverlight
    Top
  • Truly Lookless, Blend Skinnable, Completely Customizable Control

    Telerik Silverlight Grid can have its appearance and animations completely customized through Microsoft Expression Blend. You can use your own theme or you can use one of the several themes shipped with the grid control, which will help you deliver a consistent look and feel in your application.

    Top
  • Custom Layout

    You have full control over the way the data is presented in the Silverlight grid through cell customization, row layout customization and column’s cell templates. You can combine the built-in appearance of the grid cells with a custom view you have defined. You can let some of your cells get generated automatically and provide your own styles and templates for the rest. Or you can customize the grid’s column templates and use unbound data columns in RadGridView.
    To break away from the standard tabular view, you can customize the row appearance inside the grid. Designers can unleash their imagination and present the information in a visually appealing way well-suited to your application. 



    Top
  • Formatting

    To give you more control on how the data is displayed Telerik Silverlight Grid allows displaying your data as currency, percentage and any other format that suits your needs. You can use a standard .NET format string applied to your grid cells. You can customize the way the content of the RadGridView cells is arranged and displayed or can completely replace the control template of the grid cells with a custom template. Furthermore you can completely replace the control template of the grid cells with a custom template.
    Pushing further the styling capabilities of the Telerik grid control alternating rows and disabled state features are available. The disable state allows better showing the inactive state for the entire grid as well as a chosen row/cell/column.
     
    Top
  • Grouping and Aggregates

    Data can be grouped according to several criteria effectively creating a tree of groups with the leaf nodes holding the actual data records. Users can group data by dragging a column header and dropping it in the group area above the Silverlight grid. Users can also rearrange the grouping headers in the group area (again by dragging and dropping).
    The grid supports UI virtualization even when grouping, thus saving memory and reducing load time.
    To empower users to get more value from their data  the Silverlight grid provides aggregates display that calculate values taking into account every data item in the group. You can add a variety of aggregate functions, such as Sum, Count, Min, Max, Average, etc, to your data model and see the results they produce in the RadGridView. Of course, in the spirit of Silverlight, aggregate result display is fully customizable. 

     
    Top
  • Totals Row with Aggregate Functions

    Summarizing the data from a column in a single cell is a feature that is widely used in numerous scenarios. Telerik Silverlight Grid control offers a built-in totals row which makes it easy and fast to add a cell which represents the calculated values across a range of data. The summary row with aggregates is available for each column in the whole grid and/or for each individual group. The user can choose to show in the footer row from a variety of aggregate functions such as Sum, Count, Min, Max, Average and etc.

     
    Top
  • Sorting

    You can have Telerik Silverlight Grid automatically sort its columns by setting a single property. There are three sorting modes: ascending, descending and no sort.
    In addition to the simple one-column sorting Telerik grid allows you to sort data by several columns just like in Microsoft Excel. Furthermore, you can define column sorted color for better user experience.
    Top
  • Filtering and Excel-like Filtering

    Telerik Silverlight Grid allows end users to filter data by applying filter patterns or their own filter criteria, hiding the records that do not match the filter thus accessing only the data they need. For each column RadGridView creates a filtering dropdown menu with the expressions applicable for the respective data type.



    You can filter data against single or multiple columns, search as you type or filter in an Excel-like fashion.



    Top
  • Hierarchy

    Telerik Silverlight Grid has an extremely flexible hierarchy model, which allows for meaningful organization of complex data. The grid can automatically detect hierarchical relationship if bound to an ADO.NET DataSet and display the data accordingly.
    The control provides:
    • Table hierarchy – allowing you to define your hierarchy settings when binding to different data tables
    • Property hierarchy - the Silverlight grid hierarchy support also extends to .NET objects and can display them in a hierarchical fashion
    • Custom hierarchy - Telerik Silverlight Grid triggers an event that you can use to implement your own child data access logic. You can use this feature to define your hierarchy even when child data comes from legacy systems, XML files, COM, etc.
    • Self-reference hierarchy – allows you to define a relation that points back to the same table


    Top
  • Built-in Data Validation

    Telerik Silverlight Grid supports metadata-driven validation via data annotations. You can use the grid with the Validation Summary class to implement the automatic validation UI provided by the platform and also benefit from the server-side validation attributes provided by RIA Services. The built-in validation operates on two layers – UI and Data. Furthermore, using the extensible event based API of RadGridView users can plug their own data validation mechanism.


     
    Top
  • Column Types

    The Grid allows you choose from several predefined column types. The supported out-of-the-box columns are: Data, Hyperlink, DynamicHyperlink, Image, Select, ToggleRowDetailsVisibility and MaskedTextBox. They provide a built-in validation support for editing which cover most of the editing scenarios. If there are specific requirements, the built-in columns can be inherited and their editing validation mechanism can be used without any problem. Furthermore RadGridView offers flexible appearance model through the CellEditTemplate property of the column which allows any control to be used as editor.

     
    Top
  • Frozen Columns

    RadGridView allows you to keep part of your data in your Silverlight grid always visible putting the rest of the data in context. To freeze columns, you simply set the FrozenColumnCount property on the Grid to the number of columns you want to freeze.
    Top
  • Row Details

    Telerik Silverlight Grid supports Row Details, which can be used to present additional information related to the row in a visually appealing manner. The Row Details is a very convenient feature when the space at hand is insufficient for the data that needs to be presented.
    Row Details can also be used for providing a more convenient editing environment for end-users. Defined through a data template, Row Details can present virtually anything to the user, be it for viewing-only or editing.

    Top
  • Selecting and Navigating

    Telerik Silverlight Grid provides a familiar selection API that will make Silverlight developers feel at home. The control supports single and multiple record selection that can be manipulated both with the mouse and the keyboard.
    Top
  • Multiple Cells Selection

    This Excel-like feature brings the user experience in RadGrid to another level and is the most important building block for the Copy and Paste functionality.
    Top
  • Copy/Paste in RadGrid and to/from Excel

    Copy/paste from Grid to Excel or from Excel to RadGridView is very useful when the data comes in Excel format and should be easily put in RadGridView.

    Top
  • Localization Support

    Telerik Silverlight Grid provides advanced Localization support.  Two new properties were added, so that  you don’t have to always create an instance of the LocalizationManager:
    • Default Culture property -  you can change localized values without changing the UI culture of the current thread
    • DefaultResourceManager  - you change localized values using a new resource manager, i.e. a new resource file.
    In addition, as RadGridView for Silverlight and WPF share the same API, once a control has been localized for Silverlight, the control's declaration can be reused in WPF.
    Top
  • Export to Word/Excel/CSV

    With RadGridView you can easily export data to Microsoft Excel/Microsoft Word/CSV..
    Top
  • Printing

    RadGridView for Silverlight now supports printing by using PrintToHtml() method.
    Top
  • VS Plug-in for Testing RadControls

    Finally an automated testing tool built for developers. Record cross-browser tests, customize them in code within Visual Studio or convert them to unit tests. What’s more, Test Studio is the best way to test RadControls for Silverlight. The powerful test recorder automatically detects the controls and exposes commonly used verifications. Learn more
    Top
  • WPF/Silverlight Code Compatibility

    The Silverlight Grid shares a common codebase and API with its WPF counterpart. This means that you can achieve close to 100% code reuse for your grid logic if you have parallel Silverlight/WPF development.

    Top
  • Expression Column

    The Expression column in RadGridView calculates and displays information from the business object’s properties. The displayed information can be a result form mathematical or logical operations described as LINQ Expression trees.