我正在 ASP.Net 中设计一个物流系统。在订单处理页面中,订单由网格视图显示,我想将行的字体样式更改为粗体,标记为“未处理的订单”。谢谢。
问问题
1498 次
2 回答
3
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string OrStatus = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Orderstatus"));
if (OrStatus == "Order not processed")
{
//You can use whatever you want to play with rows
e.Row.Cells[0].Font.Bold = true;
e.Row.Cells[2].CssClass = "gridcss";
}
}
}
遵循该代码。这会有所帮助
于 2013-07-25T06:29:58.960 回答
2
您可以在网格的“rowdatabound”事件中执行此操作。
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
GridView grid = GridView1;
GridViewRow row = e.Row;
if (row.RowType == DataControlRowType.DataRow)
{
string orderstatus= Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Orderstatus"));
if(orderstatus=="Order not processed)
{
//write your code to change css
}
}
}
于 2013-07-25T05:34:46.520 回答