原先在DataGrid裏的方法也還能夠照樣使用:
<asp:GridView ID= "GridView1 " runat= "server " ......... OnRowDataBound= "GridView1_RowDataBound ">
********************
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate )
{
DropDownList ddlst = (DropDownList)e.Row.FindControl( "DropDownList1 ");
ddlst.BackColor = System.Drawing.Color.LightYellow;
//仍然能夠在綁定時找到摸版列裏的控件
}
}
ide