Bug with ASP.NET Dropdownlist and SelectedIndexChanged

M

Mark Vejvoda

I am using c# with a dropdownlist control in and aspx page with dll in
codebehind. I populate the control by creating a dataset then binding the
dataset to the control ONLY when:
if(Page.IsPostBack == false)
{

}

But when I load the control and set the selected index to a value based on a
flag in a cookie in the same page_load event, say username is set to bob,
when I change the selected item to another name all works ok. But if I
change back to what the page loaded with the original time (ie bob) the
changed event doesn't fire only the page_load does. To correct this defect I
stored a boolean flag to tell me if the event was fired... if not in the
pre-render of the page I explicity call the changed event on the dropdown
and all works ok.

Hope this helps anyone else out there with the same prob.
 
S

sacred

Sounds like the same problem I am having.

It actually has to do with the order microsoft is firing
the events. It fires the page_load event before the
dropdowlist change envent.

I haven't figured out a solution yet in .NET but am
cosnidering other javaccript and hidden field options.

Let me know if you figure it out.

Many thanks,

Sacred
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top