If I remove everything from the EditItemTemplate then my dropdownlist is gone. I've included a code-behind event to occur with a selection of the dropdownlist but I still keep getting an error.
Code-behind:
Protected Sub MyMethod(ByVal sender As Object, ByVal e As System.EventArgs)
Dim DropDownList1 As New System.Web.UI.WebControls.DropDownList
Dim Label1 As New Label
DropDownList1 = CType(Me.DetailsView1.FindControl("DropDownList1") , DropDownList)
Label1 = CType(Me.DetailsView1.FindControl("Label1"), Label)
Label1.Text = DropDownList1.SelectedItem.Text
End Sub
Error Message:
"NullRefereceException was unhandled by user code.
Object reference not set to an instance of an object." which was in reference to:
Label1.Text = DropDownList1.SelectedItem.Text
|