Thursday, March 19, 2009

Finding Control properties within the Gridview

protected void MyGridView_OnRowDataBound(object sender, GridViewRowEventArgs e)

{ if (e.Row.RowType == DataControlRowType.DataRow)

{

DropDownList ddlMyList = (DropDownList)e.Row.FindControl("ddlMyList");
// Do some logic to populate my ddlMyList with data
ddlMyList.SelectedValue = DataBinder.Eval(e.Row.DataItem, "ID").ToString();
}

}

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. How it will be if there is some explanation of your thoughts. :)

    ReplyDelete