G
Guest
Hello. I have the following code on an ASP webform that formats a
dropdownlist named ddlCustomer...
'Populate ddlCustomer
Dim CustAdapter As New SqlDataAdapter("SELECT * FROM
lkup_Customers", SqlConnection1)
Dim CustDataset As New DataSet
CustAdapter.Fill(CustDataset, "lkup_Customers")
Me.ddlCustomer.DataMember = "lkup_Customers"
Me.ddlCustomer.DataSource = CustDataset
Me.ddlCustomer.DataTextField = "CompanyName"
Me.ddlCustomer.DataValueField = "CustomerID"
Me.ddlCustomer.DataBind()
Me.ddlCustomer.Items.Insert(0, New ListItem("", "")) 'Create Default
Blank Row
My problem is that when I use the syntax ddlCustomer.SelectedValue to try
and retrieve the user-selected value, the value is always "" (null). What
can I do to retrieve the selectedvalue? Thanks.
dropdownlist named ddlCustomer...
'Populate ddlCustomer
Dim CustAdapter As New SqlDataAdapter("SELECT * FROM
lkup_Customers", SqlConnection1)
Dim CustDataset As New DataSet
CustAdapter.Fill(CustDataset, "lkup_Customers")
Me.ddlCustomer.DataMember = "lkup_Customers"
Me.ddlCustomer.DataSource = CustDataset
Me.ddlCustomer.DataTextField = "CompanyName"
Me.ddlCustomer.DataValueField = "CustomerID"
Me.ddlCustomer.DataBind()
Me.ddlCustomer.Items.Insert(0, New ListItem("", "")) 'Create Default
Blank Row
My problem is that when I use the syntax ddlCustomer.SelectedValue to try
and retrieve the user-selected value, the value is always "" (null). What
can I do to retrieve the selectedvalue? Thanks.