Example #1
0
        public void GridSelectableRows()
        {
            var tmp = new Grid();

            var column = new WebGrid.Columns.SystemColumn("column", SystemColumn.SelectColumn,
                                                          tmp) {Visibility = Visibility.Both};

            tmp.MasterTable.Columns.Add(column);

            tmp.ID = "wggrid";
            tmp.DefaultVisibility = Visibility.Both;
            tmp.RecordsPerRow = 2;
            tmp.PagerType = PagerType.None;
            tmp.Width = Unit.Pixel(1000);

            Testpage.Controls.Add(tmp);

            tmp.Mode = Mode.Grid;
            tmp.DataSourceId = "Categories";
            tmp.ConnectionString = ConnectionAccessOleDb;
            tmp.SetSelectedRows = "1!3!5";
            var sb = new StringBuilder();
            var sw = new StringWriter(sb);
            var gridwriter = new HtmlTextWriter(sw);
            tmp.RenderControl(gridwriter);
            Assert.Greater(tmp.MasterTable.Rows.Count, 0);
            Assert.LessOrEqual(tmp.SystemMessage.Count, 1); // 15-day license key message
            Assert.AreEqual(tmp.Mode, Mode.Grid);
            Assert.AreEqual(tmp.GetGetSelectedRows().Length, 3);
        }