Intersoft WebGrid Documentation
Walkthrough: Configuring WebGrid to load PreviewRow on demand
See Also Send comments on this topic.

Glossary Item Box

This walkthrough shows you how to load PreviewRow on demand.

During this walkthrough, you will learn how to do the following:

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • Visual Studio 2005 Application.
  • Access to the Microsoft Access Northwind database.

 Step-By-Step Instructions

  1. Binding WebGrid.NET to AccessDataSource.
  2. Use Employees table instead of Customers table.
  3. Open WebGrid.NET Designer - RootTable.
  4. Set PreviewRowVisible to True.
  5. In PreviewRowSettings, set DefaultExpanded to False and LoadOnDemand to True.
  6. In LoadPreviewRow server side event, add the following code:

    C# Copy ImageCopy Code
    using ISNet.WebUI.WebGrid;
    
    protected void WebGrid1_LoadPreviewRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e)    
    {        
       if (e.Row.Type == ISNet.WebUI.WebGrid.RowType.Record)        
       {            
          e.Row.PreviewRowValue = ((DataRowView)e.Row.DataRow)["Notes"];            
          WebGrid grid = sender as WebGrid;            
          grid.ClientAction.SetStatus("Ready.");        
       }    
    }
    

  7. Compile and run the project. The WebGrid will look like following.

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.