本文整理汇总了C#中TableRow.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.GetType方法的具体用法?C# TableRow.GetType怎么用?C# TableRow.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableRow
的用法示例。
在下文中一共展示了TableRow.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: populateTable
/*
* void populateTable()
* @params: none
* @return: none
* This method populates the list of requests from the user for the administrator to approve
* The user can see the requests he has made and see its status, whether approved, rjected or pending
*/
protected void populateTable()
{
using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(conString))
{
com = new SqlCommand("SELECT * FROM REQUEST_VIEW WHERE [email protected] ORDER BY STATUS DESC,BOOKING_DATE", con);
con.Open();
string username = HttpContext.Current.User.Identity.Name;
com.Parameters.Add("@username", SqlDbType.VarChar).Value = username ;
SqlDataReader reader = com.ExecuteReader();
TableRow t = new TableRow();
Array controlls = Array.CreateInstance(t.GetType(), 100);
Table1.Rows.CopyTo(controlls, 0);
Table1.Rows.Clear();
Table1.Rows.Add(((TableRow)controlls.GetValue(0)));
while (reader.Read())
{
string requestId = reader["REQUEST_ID"].ToString();
string familyname = reader["FAMILY_NAME"].ToString();
string bookingdate = ((DateTime)reader["BOOKING_DATE"]).ToShortDateString();
string title = reader["TITLE"].ToString();
string status = reader["STATUS"].ToString();
TableRow r = new TableRow();
TableCell c = new TableCell();
c.Text = familyname;
r.Cells.Add(c);
c = new TableCell();
c.Text = title;
r.Cells.Add(c);
c = new TableCell();
c.Text = bookingdate;
r.Cells.Add(c);
c = new TableCell();
if (status.Equals("APPROVED"))
{
Label b = new Label();
b.Text = "Approved";
b.Width = Unit.Pixel(30);
b.Height = Unit.Pixel(30);
c.Controls.Add(b);
}
else if (status.Equals("REJECTED"))
{
Label b = new Label();
b.Text = "Rejected";
b.Width = Unit.Pixel(30);
b.Height = Unit.Pixel(30);
c.Controls.Add(b);
}
else
{
Label b = new Label();
b.Text = "Not Approved";
b.Width = Unit.Pixel(30);
b.Height = Unit.Pixel(30);
c.Controls.Add(b);
}
r.Cells.Add(c);
Table1.Rows.Add(r);
}
reader.Close();
}
}
示例2: populateTable
/*
* void populateTable()
* @params: none
* @return: none
* This method populates the list of requests from the user for the administrator to approve
* Admin can view different request and aprove them as he wish
*/
protected void populateTable()
{
using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(conString))
{
com = new SqlCommand("SELECT * FROM REQUEST_VIEW ORDER BY STATUS DESC,BOOKING_DATE", con);
con.Open();
SqlDataReader reader = com.ExecuteReader();
TableRow t = new TableRow();
Array controlls = Array.CreateInstance(t.GetType(), 100);
Table1.Rows.CopyTo(controlls, 0);
Table1.Rows.Clear();
Table1.Rows.Add(((TableRow)controlls.GetValue(0)));
while (reader.Read())
{
string requestId = reader["REQUEST_ID"].ToString();
string familyname = reader["FAMILY_NAME"].ToString();
string bookingdate = ((DateTime)reader["BOOKING_DATE"]).ToShortDateString();
string title = reader["TITLE"].ToString();
string status = reader["STATUS"].ToString();
TableRow r = new TableRow();
TableCell c = new TableCell();
c.Text = familyname;
r.Cells.Add(c);
c = new TableCell();
c.Text = title;
r.Cells.Add(c);
c = new TableCell();
c.Text = bookingdate;
r.Cells.Add(c);
c = new TableCell();
if (status.Equals("APPROVED"))
{
Label b = new Label();
b.Text = "Approved";
b.Width = Unit.Pixel(30);
b.Height = Unit.Pixel(30);
c.Controls.Add(b);
}
else if (status.Equals("REJECTED"))
{
Label b = new Label();
b.Text = "Rejected";
b.Width = Unit.Pixel(30);
b.Height = Unit.Pixel(30);
c.Controls.Add(b);
}
else
{
ImageButton b = new ImageButton();
b.ImageUrl = "images/button_ok.png";
b.ID = "ButtonA_" + requestId;
b.Click += new ImageClickEventHandler(this.ButtonA_Click);
b.Width = Unit.Pixel(30);
b.Height = Unit.Pixel(30);
c.Controls.Add(b);
b = new ImageButton();
b.ImageUrl = "images/DeleteRed.png";
b.ID = "ButtonR_" + requestId;
b.Click += new ImageClickEventHandler(this.ButtonR_Click);
b.Width = Unit.Pixel(30);
b.Height = Unit.Pixel(30);
c.Controls.Add(b);
}
r.Cells.Add(c);
Table1.Rows.Add(r);
}
reader.Close();
}
}