当前位置: 首页>>代码示例>>C#>>正文


C# Grid.RenderControl方法代码示例

本文整理汇总了C#中WebGrid.Grid.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.RenderControl方法的具体用法?C# Grid.RenderControl怎么用?C# Grid.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebGrid.Grid的用法示例。


在下文中一共展示了Grid.RenderControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetEmployeesAccessMasterGrid

        public void GetEmployeesAccessMasterGrid()
        {
            Grid mastergrid = new Grid
                                  {
                                      DataSourceId = "Employees",
                                      ID = "test",
                                      Page = Testpage,
                                      ConnectionString = ConnectionAccessOleDb
                                  };
            Testpage.Controls.Add(mastergrid);

            Grid slavegrid = new Grid
                                 {
                                     DataSourceId = "Territories",
                                     ID = "test2",
                                     Page = Testpage,
                                     MasterGrid = "test",
                                     ConnectionString = ConnectionAccessOleDb
                                 };
            Testpage.Controls.Add(slavegrid);

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

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

            Assert.Greater(mastergrid.MasterTable.Rows.Count, 1);
            Assert.IsTrue(mastergrid.MasterTable.GotSchema);
            Assert.IsFalse(slavegrid.MasterTable.GotSchema);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:35,代码来源:Relations.cs

示例2: GridRowBoundAllowEditInRow

        public void GridRowBoundAllowEditInRow()
        {
            //Update The record set, we are updating record set 11
            SqlConnectionUpdate();

            Grid grid = new Grid();
            SetupTestGrid(grid);
            grid.PageSize = 100;
            grid.Culture = new System.Globalization.CultureInfo("en-US");
            grid.RowHighLight = System.Drawing.Color.Azure;
            ((WebGrid.DateTime)grid["dtmDate"]).Format = dateformat;
            grid.RaisePostBackEvent("RecordCancelClick!");
            grid.GridRowBound += grid_GridRowBound;
            grid["intTest"].AllowEditInGrid = true;
            grid["decTest"].AllowEditInGrid = true;
            grid["dtmDate"].AllowEditInGrid = true;
            grid["vchtest"].AllowEditInGrid = true;
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            Assert.Greater(grid.MasterTable.Rows.Count, 1);

            // These are triggers from html being rendered.

            string[] triggerStrings = new[]
                                          {
                                               "wggrid_40_vchTest",
                                              "wggrid_40_decTest",
                                              "wggrid_40_intTest",
                                              "wggrid_40_dtmDate",
                                      //        "wggrid_40_dtmDate_trigger",
                                              "cb_wggrid_40_bitFlag",
                                              "wggrid_40_bitFlag",
                                              "onmouseover=\"wgrowhighlight",
                                        //      "calendar.gif",
                                              "wggrid_11_vchTest",
                                              "wggrid_11_decTest",
                                              "wggrid_11_intTest",
                                              "wggrid_11_dtmDate",
                                      //        "wggrid_11_dtmDate_trigger",
                                              "cb_wggrid_11_bitFlag",
                                              "wggrid_11_bitFlag",
                                              //DateTime column with today's DateTime
                                              "value=\""+DateTime.Now.ToString(dateformat)+"\" id=\"wggrid_11_dtmDate\"",
                                              //Test column with 'blah'+ DateTime
                                         //    "maxlength=\"50\"  value=\"blah" +DateTime.Now.ToString(dateformat)+"\" id=\"wggrid_11_vchTest\"",
                                           //Decimal column with value 5634 formatted default "N2"
                                            "style=\"text-align: Right;\" value=\"5,634.00\" id=\"wggrid_11_decTest\"",
                                            //Number column with 33345 formatted default with "N0"
                                            "style=\"text-align: Right;\" value=\"33,345\" id=\"wggrid_11_intTest\""
                                          };

            string content = sb.ToString();
            foreach (string part in triggerStrings)
            {
                int res = content.IndexOf(part);
                Assert.Greater(res, -1,part+Environment.NewLine+content);
            }
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:60,代码来源:ColumnValue.cs

示例3: RenderEmptyGrid

        public void RenderEmptyGrid()
        {
            Grid grid = new Grid();

            grid.ID = "test";
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:10,代码来源:Rendering.cs

示例4: SqlServerGrouping

 public void SqlServerGrouping()
 {
     Grid grid = new Grid();
     SetupSqlServerGrid(grid);
     grid.GroupByExpression = "ProductID";
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
     Assert.Greater(grid.MasterTable.Rows.Count, 1);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:11,代码来源:Grouping.cs

示例5: GetUnknownDataSource

 public void GetUnknownDataSource()
 {
     Grid grid = new Grid();
     grid.DataSourceId = "UnKnown";
     grid.ID = "test";
     grid.Page = Testpage;
     grid.ConnectionString = ConnectionAccessOleDb;
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:12,代码来源:Exception.cs

示例6: GetEmployeesErrorWhere

 public void GetEmployeesErrorWhere()
 {
     Grid grid = new Grid();
     grid.DataSourceId = "Employees";
     grid.ID = "test";
     grid.Where = "ErrorInWhere";
     grid.ConnectionString = ConnectionAccessOleDb;
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:12,代码来源:Exception.cs

示例7: GridRowBound

 public void GridRowBound()
 {
     Grid grid = new Grid();
     SetupTestGrid(grid);
     grid.RaisePostBackEvent("RecordCancelClick!");
     grid.GridRowBound += grid_GridRowBound;
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
     Assert.Greater(grid.MasterTable.Rows.Count, 1);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:12,代码来源:ColumnValue.cs

示例8: GetEmployeesAccessInvalidMasterGrid

 public void GetEmployeesAccessInvalidMasterGrid()
 {
     Grid grid = new Grid();
     grid.DataSourceId = "Employees";
     grid.ID = "test";
     grid.Page = Testpage;
     grid.MasterGrid = "NotFound";
     grid.ConnectionString = ConnectionAccessOleDb;
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:13,代码来源:Exception.cs

示例9: GetAccessOleDBAllowEditInGridTrue

 public void GetAccessOleDBAllowEditInGridTrue()
 {
     var grid = new Grid {Sql = "SELECT * FROM Employees", ID = "test"};
     grid["FirstName"].AllowEditInGrid = true;
     grid["LastName"].AllowEditInGrid = true;
     grid.DefaultVisibility = Visibility.Both;
     grid.ConnectionString = ConnectionAccessOleDb;
     var sb = new StringBuilder();
     var sw = new StringWriter(sb);
     var gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
     Assert.AreEqual(grid.AllowEditInGrid, true);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:13,代码来源:Properties.cs

示例10: GetAccessOleDb

 public void GetAccessOleDb()
 {
     Grid grid = new Grid();
     grid.Sql = "SELECT * FROM Employees";
     grid.ID = "test";
     grid.Page = Testpage;
     grid.ConnectionString = ConnectionAccessOleDb;
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
     Assert.Greater(grid.MasterTable.Rows.Count, 1);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:13,代码来源:DataSource.cs

示例11: LoadGridWithEmployeesGenericDictionary

        public void LoadGridWithEmployeesGenericDictionary()
        {
            NorthwindEmployeeData employeedata = new NorthwindEmployeeData();

            Dictionary<int,NorthwindEmployee> employees = employeedata.GetAllEmployeesDictionary("", 0, 100);

            Grid grid = new Grid();
            grid.DataSource = employees;
            grid.ID = "test";
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            Assert.AreEqual(grid.MasterTable.Rows.Count, employees.Count);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:15,代码来源:DataSourceGeneric.cs

示例12: GetAccessOleDBAllowEditInGridTFalse

 public void GetAccessOleDBAllowEditInGridTFalse()
 {
     var grid = new Grid
                    {
                        Sql = "SELECT * FROM Employees",
                        ID = "test",
                        DefaultVisibility = Visibility.Both,
                        ConnectionString = ConnectionAccessOleDb
                    };
     var sb = new StringBuilder();
     var sw = new StringWriter(sb);
     var gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
     Assert.AreEqual(grid.AllowEditInGrid, false);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:15,代码来源:Properties.cs

示例13: GetAccessOleDbCacheIsFalse

 public void GetAccessOleDbCacheIsFalse()
 {
     Grid grid = new Grid();
     grid.Sql = "SELECT * FROM Employees";
     grid.ID = "test";
     grid.CacheGridStructure = false;
     grid.ConnectionString = ConnectionAccessOleDb;
     grid.Page = Testpage;
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
     grid.RenderControl(gridwriter);
     Assert.Greater(grid.MasterTable.Rows.Count, 1);
     Assert.IsFalse(grid.MasterTable.CacheDatasourceStructure);
     Assert.IsFalse(grid.MasterTable.GotDataSourceCache);
 }
开发者ID:webgrid,项目名称:WebGrid,代码行数:16,代码来源:DataSource.cs

示例14: CreateAndDeleteRecord

        public void CreateAndDeleteRecord()
        {
            CreateRecordSelect();

            int CategoryId = GetCategoryId();

            Grid grid = new Grid();
            Testpage.Controls.Add(grid);
            SetDataSource(grid);
            grid.ID = "test";
            grid.DefaultVisibility = Visibility.Both;
            grid.RecordsPerRow = 2;
            grid.PagerSettings.PagerType = PagerType.Standard;
            grid.Width = Unit.Pixel(1000);

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            Assert.AreEqual(grid.MasterTable.DataSourceType, DataSourceControlType.AccessDataSource);
            int records = grid.MasterTable.Rows.Count;

            grid = new Grid();
            Testpage.Controls.Add(grid);
            SetDataSource(grid);
            grid.ID = "test";
            grid.DefaultVisibility = Visibility.Both;
            grid.RecordsPerRow = 2;
            grid.PagerSettings.PagerType = PagerType.Standard;
            grid.Width = Unit.Pixel(1000);
            grid.RaisePostBackEvent(string.Format("RecordDeleteClick!{0}", CategoryId));

            sb = new StringBuilder();
            sw = new StringWriter(sb);
            gridwriter = new HtmlTextWriter(sw);
            ////grid.ReLoadData = true;
            grid.RenderControl(gridwriter);

             //   Assert.AreEqual(grid.MasterTable.Rows.Count,  GetCategoryCount());
            //   Assert.AreEqual(records-1, grid.MasterTable.Rows.Count);
            Assert.AreEqual(grid.DisplayView, DisplayView.Grid);
            Assert.LessOrEqual(grid.SystemMessage.Count, 1);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:43,代码来源:DataSourceControl.cs

示例15: CreateAndDeleteRecord

        public void CreateAndDeleteRecord()
        {
            CreateRecord();

            string CategoryId =
                Query.ExecuteScalar("SELECT TOP 1 CategoryID FROM Categories ORDER BY CategoryID DESC",
                                    ConnectionAccessOleDb).ToString();

            Grid grid = new Grid();
            grid.DataSourceId = "Categories";
            grid.ID = "test";
            grid.ConnectionString = ConnectionAccessOleDb;
            grid.DefaultVisibility = Visibility.Both;
            grid.RecordsPerRow = 2;
            grid.PagerSettings.PagerType = PagerType.None;
            grid.Width = Unit.Pixel(1000);

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            int records = grid.MasterTable.Rows.Count;

            grid = new Grid();
            grid.DataSourceId = "Categories";
            grid.ID = "test";
            grid.ConnectionString = ConnectionAccessOleDb;
            grid.DefaultVisibility = Visibility.Both;
            grid.RecordsPerRow = 2;
            grid.PagerSettings.PagerType = PagerType.None;
            grid.Width = Unit.Pixel(1000);
            grid.RaisePostBackEvent("RecordDeleteClick!" + CategoryId);

            sb = new StringBuilder();
            sw = new StringWriter(sb);
            gridwriter = new HtmlTextWriter(sw);
            grid.MasterTable.GetData(true);
            grid.RenderControl(gridwriter);

               //     Assert.Less(grid.MasterTable.Rows.Count, records);
            Assert.AreEqual(grid.DisplayView, DisplayView.Grid);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:42,代码来源:PostBackClick.cs


注:本文中的WebGrid.Grid.RenderControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。