【发布时间】:2014-03-08 16:12:37
【问题描述】:
我有我的代码来更改 GridView 背景颜色中的行 状态完成。我的代码做得很好,但它不起作用。
protected void status_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlStatus = (DropDownList)sender;
string someVariable1 = ddlStatus.SelectedItem.Text; // gets the Text displayed
string someVariable2 = ddlStatus.SelectedItem.Value; // gets the Value
GridViewRow row = (GridViewRow)ddlStatus.NamingContainer;
if (someVariable1 == "Done")
{ row.BackColor = System.Drawing.Color.Red; }
}
【问题讨论】:
-
试试this。参考 SelectedRow 后,您可以轻松更改其颜色