動的に作成される表の行に境界線の色と境界線のスタイルを設定する必要があります。どうやってやるの?
if (cmd.Connection.State == ConnectionState.Closed)
cmd.Connection.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
JobDesignation = reader.GetString(0);
JobDescription = reader.GetString(1);
NoOfVacancies = Convert.ToString(reader.GetInt32(2));
DatePosted = Convert.ToString(reader.GetDateTime(3)).Replace("00:00:00", "");
jobId = reader.GetString(4);
int tblRows = 1;
int tblCols = 1;
Table tbl = new Table();
PlaceHolder1.Controls.Add(tbl);
for (int i = 0; i < tblRows; i++)
{
TableRow tr = new TableRow();
for (int j = 0; j < tblCols; j++)
{
TableCell tc = new TableCell();
System.Web.UI.WebControls.Label lblBox = new System.Web.UI.WebControls.Label();
lblBox .Text = "Job ID:" + jobId + Environment.NewLine + "Job Designation:" + JobDesignation + Environment.NewLine + "Job Description:" + JobDescription + Environment.NewLine + "Vacancies:" + NoOfVacancies + Environment.NewLine + "Ad Posted On:" + DatePosted + "";
tc.Controls.Add(lblBox);
tr.Cells.Add(tc);
}
tr.Width = new Unit("700px");
tr.Height = new Unit("200px");
tr.BorderColor = System.Drawing.Color.Black;
tr.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid;
tbl.Rows.Add(tr);
}
ViewState["dynamictable"] = true;
} reader.NextResult();
}
}
また、Job Id、Job Description、Job Designation、No of vacancy を別の行に表示したいと考えています。どうすればそれを達成できますか?
私を助けてください。