GridView中RowDataBound绑定事件
时间:2010-10-27 来源:裴鹏
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%" OnRowDataBound="GridView1_RowDataBound">
aspx.cs:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[2].Text == "1")
{
e.Row.Cells[2].Text = "男";
}
else if (e.Row.Cells[2].Text == "2")
{
e.Row.Cells[2].Text = "女";
}
}
}
相关阅读 更多 +