DropDownList bug?

M

Martin

I find this hard to believe, but it appears the DropDownList control has a
bug.

I have a page that simply uses a SqlDataSource to populate the ddl, and then
triggers a SelectedIndexChanged event.
The ddl is configured to autopostback.

Trouble is, in the SelectedIndexChanged event handler, the ddl no longer
has any items, so I can't reference the selected value or index.
EnableViewState is set to true (in the properties window), so I should have
thought it's items would have been retained.

Same technique works for a ListBox control.

Has anyone else had this problem?

Is there a patch for it??

Thanks
Martin
 
M

Marina Levit [MVP]

Does this also happen if you use a different data source?
Do you have anything in page_load that might clear out the dropdown?
 
M

Martin

In fact it only reports null items when I assign the selectedvalue to
something

This left hand side of the assignment had an error. The unfortunate side
effect was to cause the debugger to misreport the value of the RHS after
having attempted the assignment and failed with a NullException.

And I thought managed code was supposed to stop bad memory operations!!

Martin
 
P

Patrick.O.Ige

Post what you are trying to do.
Patrick

Martin said:
In fact it only reports null items when I assign the selectedvalue to
something

This left hand side of the assignment had an error. The unfortunate side
effect was to cause the debugger to misreport the value of the RHS after
having attempted the assignment and failed with a NullException.

And I thought managed code was supposed to stop bad memory operations!!

Martin
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top