select

Grid / Programmatic Creation from XML

Rate this demo: Feedback
Run example in: C# VB.NET Change Skin:
Vista
  • BlackBlack
  • DefaultDefault
  • ForestForest
  • HayHay
  • Office2007Office2007
  • OutlookOutlook
  • SimpleSimple
  • SitefinitySitefinity
  • SunsetSunset
  • TelerikTelerik
  • VistaVista
  • Web20Web20
  • WebBlueWebBlue
  • Windows7Windows7
CustomerIDCompanyNameContactNameContactTitleAddressPostalCode
      
 Page 1 of 7, items 1 to 15 of 91.
ALFKIAlfreds FutterkisteMaria AndersSales RepresentativeObere Str. 5712209
ANATRAna Trujillo Emparedados y heladosAna TrujilloOwnerAvda. de la Constitución 222205021
ANTONAntonio Moreno TaqueríaAntonio MorenoOwnerMataderos 231205023
AROUTAround the HornThomas HardySales Representative120 Hanover Sq.WA1 1DP
BERGSBerglunds snabbköpChristina BerglundOrder AdministratorBerguvsvägen 8S-958 22
BLAUSBlauer See DelikatessenHanna MoosSales RepresentativeForsterstr. 5768306
BLONPBlondesddsl père et filsFrédérique CiteauxMarketing Manager24, place Kléber67000
BOLIDBólido Comidas preparadasMartín SommerOwnerC/ Araquil, 6728023
BONAPBon app'Laurence LebihanOwner12, rue des Bouchers13008
BOTTMBottom-Dollar MarketsElizabeth LincolnAccounting Manager23 Tsawassen Blvd.T2F 8M4
BSBEVB's BeveragesVictoria AshworthSales RepresentativeFauntleroy CircusEC2 5NT
CACTUCactus Comidas para llevarPatricio SimpsonSales AgentCerrito 3331010
CENTCCentro comercial MoctezumaFrancisco ChangMarketing ManagerSierras de Granada 999305022
CHOPSChop-suey ChineseYang WangOwnerHauptstr. 293012
COMMIComércio MineiroPedro AfonsoSales AssociateAv. dos Lusíadas, 2305432-043

Example Source Code & Description

Instructions
Open in new window
  • This approach is quite useful when you want to load grid instances with equal predefined settings on different pages in our web site. For this purpose you can use XSL transformation to import the grid content into XML file (using StringWriter to transfer the data from the xsl definition to the .xml file). After this operation you can generate StringBuilder object and get the StringWriter instance content. Finally, simply call the Page.ParseControl(stringDefinition) method and add the control returned by that method to the Controls collection of a placeholder control. This placeholder control should reside in the webform on which you want to visualize the grid.

    You can refer to this topic from the grid help as well:
    Populate grid from XML

    Note: the steps described above should take place in the PageInit handler.

    XSL definition:
    <?xml version="1.0" encoding="utf-8"?>
    
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:telerik="remove">
    
      <xsl:template match="/">
        <div>
          <radG:RadGrid ID="RadGrid1" Width="95%"
                      AllowFilteringByColumn="True" AllowSorting="True" PageSize="15" ShowFooter="True"
                      ShowGroupPanel="True" AllowPaging="True" AllowMultiRowSelection="True" runat="server">
            <HeaderStyle Width="150px" />
            <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
              <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
              <Resizing AllowRowResize="True" AllowColumnResize="True"></Resizing>
              <Selecting AllowRowSelect="True"></Selecting>
            </ClientSettings>
          </radG:RadGrid>
        </div>
      </xsl:template>
    
    </xsl:stylesheet>
    
    
    
Compatible with ASP.NET 2.0, 3.5 AJAX enabled Accessibility Verified!Valid XHTML 1.1! Optimized for Visual Studio 2005, 2008
Copyright 2002-2010 © Telerik. All right reserved  | 
Telerik Inc., 460 Totten Pond Rd, Suite 640, Waltham, MA 02451

www.telerik.com  |  Terms of Use  |  Contact Us