Esempio n. 1
0
        public void GridSelectableRows()
        {
            var tmp = new Grid();

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

            tmp.MasterTable.Columns.Add(column);

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

            Testpage.Controls.Add(tmp);

            tmp.DisplayView      = DisplayView.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.DisplayView, DisplayView.Grid);
            Assert.AreEqual(tmp.GetGetSelectedRows().Length, 3);
        }
Esempio n. 2
0
        public void GridSelectableRows()
        {
            var tmp = new Grid();

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

            tmp.MasterTable.Columns.Add(column);

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

            Testpage.Controls.Add(tmp);

            tmp.DisplayView = DisplayView.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.DisplayView, DisplayView.Grid);
            Assert.AreEqual(tmp.GetGetSelectedRows().Length, 3);
        }