日期:2014-05-17 浏览次数:20599 次
<asp:GridView ID="gv" runat="server" AutoGenerateColumns="false"
OnRowDataBound="BindStyle">
<Columns>
<asp:BoundField DataField="ID" />
<asp:BoundField DataField="NAME" />
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox runat="server" CssClass="tbCode"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
protected void BindStyle(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[0].Text == "1")
e.Row.Cells[0].BackColor = Color.Red;
}
}