|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
October 7th, 2004, 07:55 PM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
DropDownList not firing
I am using ASP C# on a web page and have an ASP dropdown list control. When select and change a different value in the dropdown list, my event is not firing.
I have used:
OnSelectedIndexChanged="ddlRoom_SelectedIndexChang ed"
in the ASPX page and this work, however I get a memory exception error when I close IE.
I have also tried:
this.ddlRoom.SelectedIndexChanged += new System.EventHandler(ddlRoom_SelectedIndexChanged);
private void ddlRoom_SelectedIndexChanged(object sender, System.EventArgs e)
but this is not firing. What is the proper way of programming an event for a dropdown list?
Thanks,
Paul
|
October 8th, 2004, 01:46 AM
|
Authorized User
|
|
Join Date: Feb 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
1. In the tag of the dropdownlist put Autopostback = "true" OnSelectedIndexChanged = "ddlRoom_SelectedIndexChanged"
2. Make sure you have the event handler subroutine (ddlRoom_SelectedIndexChanged) declared in your code
-.. -..
|
October 8th, 2004, 03:10 AM
|
Registered User
|
|
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I am a new learner ,i don't know how to study ,can you help me ?
|
October 8th, 2004, 07:13 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
What do you need help with?
|
October 8th, 2004, 02:42 PM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have the following in the .cs file:
this.ddlRoom.SelectedIndexChanged += new System.EventHandler(ddlRoom_SelectedIndexChanged);
private void ddlRoom_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
In my .ASPX file, in have:
<asp:dropdownlist id="ddlRoom" runat="server" AutoPostBack="True">
Note that I do not have the OnSelectedIndexChanged in the tag, and the method is private. This works. I am not sure why but it works.
Howevwer, I get and MS IE application error when I close IE and end the debug session in MS Visual Studio. This error only occurs when I select the dropdown list box and the event is fired.
iexplorer.exe - Application Error. The instruction at "0x10003e8d" referenced memory at "0x10003e8d". The memory could not be "read"
What could be going on?
Thanks,
Paul
|
October 8th, 2004, 05:31 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
You don't need the event in the tag. That looks right to me... The memory reference error may have nothing to do with your app; it may be an error with the browser. I get those sometimes.
Brian
|
October 11th, 2004, 11:39 AM
|
Authorized User
|
|
Join Date: Jul 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your help. It appears there is something going on behind the seens with MS IE, but I think the code is working to some agree.
Paul
|
October 12th, 2004, 11:58 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Happens every now and then. It helps to have the most current browser also, even though that shouldn't be an issue.
Brian
|
|
|