0

Trying to get the findcontrol to work so I can set the default value of the dropdownlist I have in a template field, but I'm having no luck. Am I doing something wrong?

Dim drdList As DropDownList
    For Each row As GridViewRow In gridviewComputer.Rows

        drdList = gridviewComputer.Rows(e.NewEditIndex).FindControl("statusDropDown")


    Next
Shawn
  • 2,356
  • 6
  • 48
  • 82

1 Answers1

0

Found an easier way.

Go into the gridview template editing, then under the EditItemTemplate, where I had the dropdownlist declared I selected Edit DataBindings. Refresh the Schema, then I was able to set the SelectedValue property to the corresponding field of my gridviews datasource. (Which really just fills in "Bind("columnName")" in the Code expression.) Problem solved!

Shawn
  • 2,356
  • 6
  • 48
  • 82