示例#1
0
        public void RenderGridWithRows()
        {
            Grid grid = new Grid();

            grid.ID = "test";

            Row newrow = new Row( grid.MasterTable);
            newrow["title"].Value = "title 1";
            newrow["Description"].Value = @"description 1";
            newrow["sampleurl"].Value = "sample url 1";
            newrow["PrimaryColumn"].Value = "1";
            grid.AddRow(newrow);

            newrow = new Row( grid.MasterTable);
            newrow["title"].Value = "title 2";
            newrow["Description"].Value = @"description 2";
            newrow["sampleurl"].Value = "sample url 2";
            newrow["PrimaryColumn"].Value = "2";
            grid.AddRow(newrow);

            newrow = new Row( grid.MasterTable);
            newrow["title"].Value = "title 3";
            newrow["Description"].Value = @"description 3";
            newrow["sampleurl"].Value = "sample url 3";
            newrow["PrimaryColumn"].Value = "3";
            grid.AddRow(newrow);

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
        }