Here's my scenario.
I have a custom control that inherits DropDownList. This was the old functionality of an ASP.net 1.1 control that a company created before I came on.
The control had a DefaultValue() function that I am unsure of what it did exactly, but I'm trying to mimic it. Basically, it made a property for the dropdownlist.
DropDownList1.DefaultValue = obj.COUNTY_DDL
This would assign a string value to DefaultValue, I'm assuming it set the Selected Value. For the life of me, I CANNOT SET THE SELECTEDVALUE ever! Here's the code. I believe it has something to do with where I'm trying to set this. Point me in the right direction if you can.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, MyBase.PreRender
Dim program As New wsPROF_DEVELOPMENT_PROGRAMS.PROF_DEVELOPMENT_PROGRAMSEntity
Dim entCodes() As wsPROF_DEVELOPMENT_PROGRAMS.PROF_DEVELOPMENT_PROGRAMSEntity
Dim mangager As New wsPROF_DEVELOPMENT_PROGRAMS.PROF_DEVELOPMENT_PROGRAMSManager
If GlobalAccessAll Or GlobalAccessInternal Then
entCodes = mangager.findAll
If Not UserID Is Nothing Then
If Not TransactionCode Is Nothing Then
entCodes = mangager.findByUserIDTransactionCode(UserID, TransactionCode)
entCodes = mangager.findByUserID(UserID)
'MyBase.Entities = entCodes
MyBase.DataValueField = "PROF_DEVELOPMENT_PROGRAMS_ID"
If DisplayID Then
MyBase.DataTextField = "PROF_DEVELOPMENT_PROGRAMS_ID"
MyBase.DataTextField = "PROF_DEV_PROG_DESCR"
If MyBase.SelectedValue = "" Then MyBase.SelectedValue = HttpContext.Current.Request.Item(Me.UniqueID)
If Not entCodes Is Nothing Then
MyBase.DataSource = entCodes
If m_none Then
MyBase.Items(0).Value = ""
I have a bunch of properties, all which work except:
Public Property DefaultValue() As String
Set(ByVal Value As String)
MyBase.SelectedValue = Value
ASP.NET 1.1 Developer