protected void gdView_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label a=new Label();a.ID="a";a.Text="abc";
e.Row.Cells[0].Controls.Add(a);
}为什么用gdViewRow.Rows[i].Cells[0].FindControl("a")找不到

解决方案 »

  1.   

    protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRowView data = (DataRowView)e.Row.DataItem;
                Label lblInquiryDate = (Label)e.Row.FindControl("lblInquiryDate");
    ...
    ...如果知道具体哪一行的话Label lblOrderDate = (Label)grd.Rows[0].FindControl("lblOrderDate");
      

  2.   

    好象 在gdView_RowCreated() 创建的