protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[0].Text.Trim() == "1")
{ e.Row.Cells[0].Text = "1-2节"; }
if (e.Row.Cells[0].Text.Trim() == "2")
{ e.Row.Cells[0].Text = "3-4节"; }
if (e.Row.Cells[0].Text.Trim() == "3")
{ e.Row.Cells[0].Text = "5-6节"; }
if (e.Row.Cells[0].Text.Trim() == "4")
{ e.Row.Cells[0].Text = "7-8节"; }
for (int i = 1; i <= 7; i++)
{
string coursename = e.Row.Cells[i].Text.Trim();
if (coursename != null || coursename != " ")
{
DataTable dt = (new sql()).getdetails(coursename);
if (dt.DefaultView.Count > 0)
{
DataRow dr = dt.Rows[0];
string str = "课程名称:" + dr["coursename"];
str = str + "\n任课老师:" + dr["teaname"];
str = str + "\n开课时间:" + dr["begintime"];
str = str + "\n开课地点:" + dr["beginplace"];
str = str + "\n课程学分:" + dr["tcount"];
str = str + "\n考试类型:" + dr["checkstyle"];
str = str + "\n课程类型:" + dr["coursequatity"];
str = str + "\n课程学时:" + dr["xueshi"];
e.Row.Cells[i].ToolTip = str;
}
}
}