Exemplo n.º 1
0
        public void GetSetDataSourceXml()
        {
            Grid grid = new Grid();
            grid.ID = "test";

            // IMPORTANT when selecting nodes with child nodes:
            // WebGrid uses first selected node as template for loading column settings, and uses
            // these column settings for updating and inserting nodes into your XML file.
            grid.SetDataSource( Path + "\\WebGridMessages.xml", "//Language//*");

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            Assert.AreEqual(grid.MasterTable.DataSourceType, DataSourceControlType.EnumerableDataSource);
            Assert.Greater(grid.MasterTable.Rows.Count, 1);
        }