I have droplistlist populated from database.When i add records everthing is ok with the dropdownlist: but when i edit records it shows duplicate values like
how can i romove duplicate values?
Dim dt As Data.DataTable = objlist.GetPriorityList()
Dim dr As Data.DataRow = dt.NewRow
dr.Item("PriorityID") = 0
dr.Item("Priority") = "--Select--"
ddlPriority.DataSource = dt
ddlPriority.DataTextField = "Priority"
ddlPriority.DataValueField = "PriorityID"
ddlPriority.SelectedValue = 0
When i add records ddlpriority is properly populated.
But when edit sub is called it shows values like
here is code of edit subroutine
ddlPriority.SelectedItem.Text = dr("Priority")
ddlist.Items.FindByText(dr("Priority") ).Selected = true
gaves error "Cannot have multiple items selected in a DropDownList. "
But when i add "'ddlPriority.ClearSelection()" before urs line of code it really works.
Thank u greeny_1984 and srikathkadem