Drop-down lists populated twice due to page_load being processed t

S

smccreadie

I've got some drop-downs on a page that are being loaded as such:

Sub load_existing_accounts()
'loads existing protocol accounts into the grid if any
Dim db As Database = DatabaseFactory.CreateDatabase()
Dim ds As DataSet =
db.ExecuteDataSet("billing_protocol_accounts_get_current",
Request.QueryString("protocol_id"))

gv_accounts_in_protocol.DataSource = ds.Tables(0)
gv_accounts_in_protocol.DataBind()

'load the drop-downs below as well -- for some reason these are
coming up duplicated in each drop down??????
ddl_startup_account.DataSource = ds.Tables(0)
ddl_startup_account.DataTextField = "account_name"
ddl_startup_account.DataValueField = "billing_account_id"
ddl_startup_account.DataBind()

ddl_inventory_account.DataSource = ds.Tables(0)
ddl_inventory_account.DataTextField = "account_name"
ddl_inventory_account.DataValueField = "billing_account_id"
ddl_inventory_account.DataBind()

ddl_randomization_account.DataSource = ds.Tables(0)
ddl_randomization_account.DataTextField = "account_name"
ddl_randomization_account.DataValueField = "billing_account_id"
ddl_randomization_account.DataBind()

ddl_storage_account.DataSource = ds.Tables(0)
ddl_storage_account.DataTextField = "account_name"
ddl_storage_account.DataValueField = "billing_account_id"
ddl_storage_account.DataBind()

ddl_dispensing_fee_account.DataSource = ds.Tables(0)
ddl_dispensing_fee_account.DataTextField = "account_name"
ddl_dispensing_fee_account.DataValueField = "billing_account_id"
ddl_dispensing_fee_account.DataBind()

End Sub

They all contain the same data from the datasource plus have a
statically-defined item with the appenddatabounditems = True.

For some reason, this page is calling page_load twice which results in the
drop-downs containing a duplicate of the datasource items. The gridview
which is also filled, only has a single copy as expected.

I'm not sure where is is coming from. The page_load sub is clearly marked as

If Not IsPostBack Then
'load existing accounts
load_existing_accounts()
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top