dropdownlist event not happening

V

V. Jenks

I'm having horrible luck with events today...

I have one dropdownlist which, on changed, is supposed to
load another.

Here's my code (with needless code ommitted):

1. The ddl's

<asp:dropdownlist
id="OIItemList"
onload="OIItemList_Load"
onselectedindexchanged="OIItemList_Changed"
runat="server">
</asp:dropdownlist>

<asp:dropdownlist
id="OIProdOptionList"
runat="server">
</asp:dropdownlist>

2. The event (see above, first DDL):

protected void OIItemList_Changed(object sender,
System.EventArgs e)
{
//load product options by product ID
try
{
//get ID of selected product
int selProduct =
Convert.ToInt32(OIItemList.SelectedItem.Value);
IProduct foundProd = this.FindLocalProduct(selProduct);

//get all options from db
IList options = foundProd.Options;

if (options != null)
{
//add a default
OIProdOptionList.Items.Add(new ListItem("- Choose One
-", ""));

//add each to the dropdownlist
foreach (IProductOption po in options)
{
//capture name and price together
string name = String.Format(
"{0} {1}",
po.Name,
po.Price.ToString("C"));

//add to list
ListItem prodOp = new ListItem(name, po.ID.ToString());

//add list to control
OIProdOptionList.Items.Add(prodOp);
}
}
}
catch (Exception exp)
{
throw new ExceptionProxy(
exp.Source,
exp.GetHashCode(),
exp.Message,
exp.InnerException,
true);
}
}


I put a breakpoint in the event handler, it never happens,
so the code inside of it is irrelevant to the post, really.

Thanks!

-v
 
W

weichung[MCSD,MCDBA]

Hi,

please try to set the "AutoPostback()" properties to true.

hope its helps.
weichung
 
V

V. Jenks

Aww geeze, I knew I was missing something simple. I've
been off on a Java project for 6 months, I'm a little rusty.

Thanks!

-v
 

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

Top