我在ASP.Net设计一个物流系统。在“订单处理”页面中,“命令”由“网格视图”显示,我希望将行的字体样式更改为粗体,并将其标记为“ordedr未处理”。谢谢。

发布于 2013-07-25 06:29:58
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-25 05:34:46
您可以在网格的“行数据库”事件中这样做。
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
}
}
}https://stackoverflow.com/questions/17849701
复制相似问题