62,041
社区成员
发帖
与我相关
我的任务
分享
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.Cells[1].Text.Trim() .....) //判断时间
{
e.Row.Cells[1].ForeColor = System.Drawing.Color.Red; //将需要的内容能够的显示为红色
}
}
<div runat="server" align="center" style=" width:100%">
<%
if (checkList.Count == 0)
{
Response.Write("<table align=\"center\" runat=\"server\" style=\"width:100%\" ><tr style=\"background-color:#A2D268\">");
Response.Write("<td>用药信息</td><td>患者信息</td><td>不良反应</td><td>国内情况</td><td>检报人信息</td><td>备注</td></tr>");
Response.Write("<tr><td colspan=\"6\">目前还没有不良反应举报信息!</td></tr></table>");
}
else
{
Response.Write("<table align=\"center\" runat=\"server\" style=\"width:100%;border-color:Blue;\" rules=\"rows\" border=\"2px\"><tr style=\"background-color:#A2D268\">");
Response.Write("<td>编号</td><td>患者信息</td><td>用药信息</td><td>不良反应</td><td>国内情况</td><td>检报人信息</td><td>备注</td></tr>");
for (int i = 0; i < checkList.Count; i++)
{
Model.Check model = checkList[i];
Response.Write("<tr style=\"cursor:hand\" onmouseover=\"this.bgColor='yellow'\" onmouseout=\"this.bgColor='#ffffff'\" onclick=\"OpenMessage('" + model.Id + "')\">");
Response.Write("<td valign=\"middle\" align=\"center\">" + (i + 1) + "</td>");
Response.Write("<td valign=\"top\" style=\"font-size: small; color: #7B7B7B\">");
if (model.Patient.Length > 10)
Response.Write(model.Patient.Substring(0, 10) + "...");
else
{
Response.Write(model.Patient);
}
Response.Write("</td>");
Response.Write("<td valign=\"top\" style=\"font-size: small; color: #7B7B7B\">");
if (model.AboutDrug.Length > 10)
Response.Write(model.AboutDrug.Substring(0, 10) + "...");
else
{
Response.Write(model.AboutDrug);
}
Response.Write("</td>");
Response.Write("<td valign=\"top\" style=\"font-size: small; color: #7B7B7B\">");
if (model.Reaction.Length > 10)
Response.Write(model.Reaction.Substring(0, 10) + "...");
else
{
Response.Write(model.Reaction);
}
Response.Write("</td>");
Response.Write("<td valign=\"top\" style=\"font-size: small; color: #7B7B7B\">");
if (model.National.Length > 10)
Response.Write(model.National.Substring(0, 10) + "...");
else
{
Response.Write(model.National);
}
Response.Write("</td>");
Response.Write("<td valign=\"top\" style=\"font-size: small; color: #7B7B7B\">");
if (model.Reporter.Length > 10)
Response.Write(model.Reporter.Substring(0, 10) + "...");
else
{
Response.Write(model.Reporter);
}
Response.Write("</td>");
Response.Write("<td valign=\"top\" style=\"font-size: small; color: #7B7B7B\">");
if (model.Note.Length > 10)
Response.Write(model.Note.Substring(0, 10) + "...");
else
{
Response.Write(model.Note);
}
Response.Write("</td>");
Response.Write("</tr>");
}
Response.Write("</table>");
}
%>
</div>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (判断时间)
{
e.Row.Cells[11].BackColor = System.Drawing.Color.Red;
}
}
}