|I have a DetailsView in which I have a DropDownList in the EditItemTemplate.
I need to access the list and populate it when the Edit command is clicked on the DetailsView.
I tried the following:
protected void dvStation_ModeChanged(object sender, EventArgs e)<br />
DetailsViewRow row = dvStation.Rows;<br />
DropDownList ddlStatus = (DropDownList)row.FindControl("ddlStatus");<br />
ddlStatus.DataSource = dsStatus;<br />
ddlStatus.DataTextField = "STATUS_NAME";<br />
But its not populating my list. I also tried a SqlDataReader, did the connection and SQL, then used a while loop to populate like:
cmd = new SqlCommand(sql, conn);<br />
dr = cmd.ExecuteReader();<br />
while (dr.Read() != null)<br />
That didn't do it either...