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>