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


C# TableRow.Dispose方法代码示例

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


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

示例1: OnInit

    protected override void OnInit(EventArgs e)
    {
        String connectionString = ConfigurationManager.AppSettings["ConnectionString"];

        SqlConnection sqlConnect = new SqlConnection(connectionString);
        SqlCommand cmd = new SqlCommand();
        SqlDataReader reader;
        cmd.Connection = sqlConnect;
        cmd.CommandText = "Retrieve_MMRALL";
        cmd.CommandType = CommandType.StoredProcedure;

        var Tableheader = new System.Web.UI.WebControls.TableRow
        {
            Cells = {
                        new TableCell { Text = "MRID" },
                        new TableCell { Text = "Defect Name" },
                        new TableCell { Text = "Tester" },
                        new TableCell { Text = "Date Found" },
                        new TableCell { Text = "Severity" },
                        new TableCell { Text = "Status" },
                        new TableCell { Text = "Steps to recreate" },
                        new TableCell { Text = "Comments" },
                        new TableCell { Text = "Assigned Developer" },
                        new TableCell { Text = "Update" }

                }
        };

        MMR.Rows.Add(Tableheader);

        sqlConnect.Open();
        cmd.ExecuteNonQuery();
        reader = cmd.ExecuteReader();
        int i = 1;

        try
        {

            while (reader.Read())
            {
                Button Update = new Button();
                Update.Text = "Update";
                Update.ID = i.ToString();
                Update.Click += new EventHandler(this.Update_Click);
                Update.OnClientClick = buttonID(Update.ID);

                var DataCell = new TableCell();
                var TableRow = new TableRow
                {
                    Cells = {

                        new TableCell { Text = reader["MRID"].ToString() },
                        new TableCell { Text = reader["Defect"].ToString() },
                        new TableCell { Text = reader["Tester"].ToString() },
                        new TableCell { Text = reader["DateFound"].ToString() },
                        new TableCell { Text = reader["Severity"].ToString() },
                        new TableCell { Text = reader["Condition"].ToString() },
                        new TableCell { Text = reader["Steps"].ToString() },
                        new TableCell { Text = reader["Comment"].ToString() },
                        new TableCell { Text = reader["Developer"].ToString() },

                }
                };

                DataCell.Controls.Add(Update);

                TableRow.Cells.Add(DataCell);

              //Response.Write(Update.ID);

                MMR.Rows.Add(TableRow);
                i++;

                DataCell.Dispose();
                TableRow.Dispose();
            }

        }
        catch (Exception f)
        {
            Console.Write(f.Message);
        }
        finally
        {
        sqlConnect.Close();
        }
    }
开发者ID:KU-TheATeam,项目名称:TheDreamTeamWS,代码行数:87,代码来源:ViewMRR.aspx.cs


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