473,804 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dropdownlist event not happening

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:dropdownli st
id="OIItemList "
onload="OIItemL ist_Load"
onselectedindex changed="OIItem List_Changed"
runat="server">
</asp:dropdownlis t>

<asp:dropdownli st
id="OIProdOptio nList"
runat="server">
</asp:dropdownlis t>

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

protected void OIItemList_Chan ged(object sender,
System.EventArg s e)
{
//load product options by product ID
try
{
//get ID of selected product
int selProduct =
Convert.ToInt32 (OIItemList.Sel ectedItem.Value );
IProduct foundProd = this.FindLocalP roduct(selProdu ct);

//get all options from db
IList options = foundProd.Optio ns;

if (options != null)
{
//add a default
OIProdOptionLis t.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.ToStri ng("C"));

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

//add list to control
OIProdOptionLis t.Items.Add(pro dOp);
}
}
}
catch (Exception exp)
{
throw new ExceptionProxy(
exp.Source,
exp.GetHashCode (),
exp.Message,
exp.InnerExcept ion,
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
Nov 19 '05 #1
2 1228
Hi,

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

hope its helps.
weichung

"V. Jenks" <an*******@disc ussions.microso ft.com> wrote in message
news:14******** *************** *****@phx.gbl.. .
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:dropdownli st
id="OIItemList "
onload="OIItemL ist_Load"
onselectedindex changed="OIItem List_Changed"
runat="server">
</asp:dropdownlis t>

<asp:dropdownli st
id="OIProdOptio nList"
runat="server">
</asp:dropdownlis t>

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

protected void OIItemList_Chan ged(object sender,
System.EventArg s e)
{
//load product options by product ID
try
{
//get ID of selected product
int selProduct =
Convert.ToInt32 (OIItemList.Sel ectedItem.Value );
IProduct foundProd = this.FindLocalP roduct(selProdu ct);

//get all options from db
IList options = foundProd.Optio ns;

if (options != null)
{
//add a default
OIProdOptionLis t.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.ToStri ng("C"));

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

//add list to control
OIProdOptionLis t.Items.Add(pro dOp);
}
}
}
catch (Exception exp)
{
throw new ExceptionProxy(
exp.Source,
exp.GetHashCode (),
exp.Message,
exp.InnerExcept ion,
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

Nov 19 '05 #2
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

-----Original Message-----
Hi,

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

hope its helps.
weichung

"V. Jenks" <an*******@disc ussions.microso ft.com> wrote in messagenews:14******* *************** ******@phx.gbl. ..
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:dropdownli st
id="OIItemList "
onload="OIItemL ist_Load"
onselectedindex changed="OIItem List_Changed"
runat="server">
</asp:dropdownlis t>

<asp:dropdownli st
id="OIProdOptio nList"
runat="server">
</asp:dropdownlis t>

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

protected void OIItemList_Chan ged(object sender,
System.EventArg s e)
{
//load product options by product ID
try
{
//get ID of selected product
int selProduct =
Convert.ToInt32 (OIItemList.Sel ectedItem.Value );
IProduct foundProd = this.FindLocalP roduct(selProdu ct);

//get all options from db
IList options = foundProd.Optio ns;

if (options != null)
{
//add a default
OIProdOptionLis t.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.ToStri ng("C"));

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

//add list to control
OIProdOptionLis t.Items.Add(pro dOp);
}
}
}
catch (Exception exp)
{
throw new ExceptionProxy(
exp.Source,
exp.GetHashCode (),
exp.Message,
exp.InnerExcept ion,
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

.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
17037
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of the columns of the data grid contains a DropDownlist. I managed to create this datagrid control as follows.
3
7226
by: Clouds | last post by:
Hi ! How do I add the dynamic event handler for a dropdownlist present in the itemtemplate of a datalist !! I am doing it in the itemdatabound event of the datalist but it doesnt work... I am also setting the autopostback property to true for the dropdown list and it works but the handler doesnt get invoked at runtime... I have to do it in itemdatabound becaz whether to add the handler or not is driven based on the information which i...
2
2279
by: Michael | last post by:
Hi again, I really hope that there is a simple solution to this one, cause I'm having simular things happening to other controls on this usercontrol. I have the following control: <asp:DropDownList ID="cmbOptions" runat="server" Width="195px"> <asp:ListItem Text="Search by PO ID" Value=0 Selected="True" /> <asp:ListItem Text="Search by Field" Value=1 /> <asp:ListItem Text="Search between dates" Value=2 /> <asp:ListItem Text="Search Most...
18
5437
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.