I have a couple of DropDownList on my form. Once I am trying to submit them, they always send the first item to the database. Following is part of code related to the DropDown List.
Dim dsAccountManager As New DataSet()
Dim daAccountManager As New SqlDataAdapter()
daAccountManager.SelectCommand = cmdAccountManager
daAccountManager.Fill(dsAccountManager, "AcctMgrs"
ddlAcctMgr.DataSource = dsAccountManager
ddlAcctMgr.DataMember = "AcctMgrs"
ddlAcctMgr.DataTextField = "AccountManager"
ddlAcctMgr.DataValueField = "AcctMgrID"
ddlAcctMgr.DataBind()
Dim li As New ListItem("", "0"
ddlAccountManager.Items.Insert(0, li)
ddlAcctMgr.Items.Insert(0, li)
Try
ddlAcctMgr.Items.FindByText(Session("AccountManager").Selected = True
Catch
ddlAcctMgr.SelectedIndex = 0
End Try
Any feedback regarding this post is highly appreciated!
Dim dsAccountManager As New DataSet()
Dim daAccountManager As New SqlDataAdapter()
daAccountManager.SelectCommand = cmdAccountManager
daAccountManager.Fill(dsAccountManager, "AcctMgrs"
ddlAcctMgr.DataSource = dsAccountManager
ddlAcctMgr.DataMember = "AcctMgrs"
ddlAcctMgr.DataTextField = "AccountManager"
ddlAcctMgr.DataValueField = "AcctMgrID"
ddlAcctMgr.DataBind()
Dim li As New ListItem("", "0"
ddlAccountManager.Items.Insert(0, li)
ddlAcctMgr.Items.Insert(0, li)
Try
ddlAcctMgr.Items.FindByText(Session("AccountManager").Selected = True
Catch
ddlAcctMgr.SelectedIndex = 0
End Try
Any feedback regarding this post is highly appreciated!