Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Drop-down lists populated twice due to page_load being processed t

Reply
Thread Tools

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

 
 
smccreadie
Guest
Posts: n/a
 
      10-27-2006
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_c urrent",
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

--
Scott McCreadie
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page constructed and processed twice!? Achim Domma ASP .Net 3 12-20-2007 10:39 AM
Client request is processed twice Olivier Matrot ASP .Net 4 09-06-2007 09:32 AM
When user clicks on a link twice before the first click is completely processed.. sapta Java 1 05-24-2007 12:12 PM
Page_Load being fired twice =?Utf-8?B?Tmltcm9kIENvaGVu?= ASP .Net 7 06-09-2004 01:47 PM
Why does page_load fire twice when inheriting from a common overridable Page_Load bminder ASP .Net 1 02-23-2004 08:54 PM



Advertisments