943,603 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 7567
  • ASP.NET RSS
Apr 30th, 2009
0

SelectedIndexChanged not firing for dropdownlist

Expand Post »
For some reason, selectedindexChanged vb.net code is no longer firing. autopostback and enable viewstate are sill true. Enabled is set to true in code behind. Using VS2008.

Any idea on what can cause this?

Thanks,
Randy

ASP.NET Syntax (Toggle Plain Text)
  1. <asp:DropDownList id="ddlEmpName2"
  2. style="Z-INDEX: 138; LEFT: 192px; POSITION: absolute; TOP: 32px" runat="server" Width="152px" ForeColor="DarkBlue" DataValueField="EmployeeId" DataTextField="EmpLastFirst" DataSource="<%# dvEmpActiveList %>"
  3. Font-Size="X-Small" AutoPostBack="True" Enabled="False"
  4. AppendDataBoundItems="True"
  5. <asp:ListItem Selected="false" Text="Select" Value="0"></asp:ListItem>
  6. </asp:DropDownList>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
blackbr is offline Offline
25 posts
since Sep 2007
Apr 30th, 2009
0

Re: SelectedIndexChanged not firing for dropdownlist

Whats your code for capturing the change on the dropdown?
Reputation Points: 22
Solved Threads: 9
Junior Poster
ninjaimp is offline Offline
129 posts
since Apr 2008
Apr 30th, 2009
0

Re: SelectedIndexChanged not firing for dropdownlist

Thanks for the quick response,ninjaimp.
The session variable was set up to try to hold the info for the update, but the method does NOT fire

Public Sub ddlEmpName2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlEmpName2.SelectedIndexChanged
SelectedEmpId = ddlEmpName2.SelectedValue
Session("ddlEmpName2Session") = ddlEmpName2 '[4-29-2009]
lblOrgNameShort_DataBinding(Me, e)
SetActiveOrg(drOrg)
End Sub
Reputation Points: 10
Solved Threads: 0
Light Poster
blackbr is offline Offline
25 posts
since Sep 2007
May 1st, 2009
0

Re: SelectedIndexChanged not firing for dropdownlist

Hi Randy

There is no event selected in the HTML - runat Server is good but what sub are you going to call.

I think you have probably copied this control from another page - been there done it. Try double clicking the control and you should be fine.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tonym001 is offline Offline
11 posts
since May 2009
May 1st, 2009
0

Re: SelectedIndexChanged not firing for dropdownlist

Click to Expand / Collapse  Quote originally posted by tonym001 ...
Hi Randy

There is no event selected in the HTML - runat Server is good but what sub are you going to call.

I think you have probably copied this control from another page - been there done it. Try double clicking the control and you should be fine.
Tony,
This was existing logic. When I double-click on the control, it creates the selectedIndexChanged sub, but does NOT reference the sub in the aspx file -- I guess because it's using the default name.

I have another ddl on the page, and it works correctly, though it does NOT have autopostback set. It also does not mention the sub in the aspx.

I'm still open to suggestions...
Reputation Points: 10
Solved Threads: 0
Light Poster
blackbr is offline Offline
25 posts
since Sep 2007
May 1st, 2009
0

Re: SelectedIndexChanged not firing for dropdownlist

Copy the code for the control, delete the control, save all, close the project, open the project, add the control back in again, put the code back in (after clicking) and then try it again.

If that does not work you will have to recreate the page from scratch.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tonym001 is offline Offline
11 posts
since May 2009
May 1st, 2009
0

Re: SelectedIndexChanged not firing for dropdownlist

PS - Otherwise you could be searching the net for days
Reputation Points: 10
Solved Threads: 0
Newbie Poster
tonym001 is offline Offline
11 posts
since May 2009
Jul 15th, 2010
0
Re: SelectedIndexChanged not firing for dropdownlist
Great Dude tonym001, it worked by deleting and recreating event on double click. Really, one would have kept searching web without trying this simple trick.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mohant is offline Offline
1 posts
since Jul 2010
Jul 15th, 2010
0
Re: SelectedIndexChanged not firing for dropdownlist
Please change your front end code to include this:
<asp:DropDownList id="ddlEmpName2" 
style="Z-INDEX: 138; LEFT: 192px; POSITION: absolute; TOP: 32px" runat="server" Width="152px" ForeColor="DarkBlue" DataValueField="EmployeeId" DataTextField="EmpLastFirst" DataSource="<%# dvEmpActiveList %>" 
Font-Size="X-Small" AutoPostBack="True" Enabled="False" 
AppendDataBoundItems="True" onselectedindexchanged="ddlEmpName2_SelectedIndexChanged" >
<asp:ListItem Selected="false" Text="Select" Value="0"></asp:ListItem>
</asp:DropDownList>
Your snippet at the top does not have both a closing bracket on your DDL opening code or a reference to the onselectedindexchanged event.

Hope that helps Please remember to mark as solved once the issue is resolved.
Last edited by Lusiphur; Jul 15th, 2010 at 2:19 am.
Sponsor
Featured Poster
Reputation Points: 207
Solved Threads: 126
Practically a Posting Shark
Lusiphur is offline Offline
841 posts
since Jun 2010
Jul 16th, 2010
0
Re: SelectedIndexChanged not firing for dropdownlist
Make sure that the AutoPostBack Property is set to True on your Dropdownlist control.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
CodeGorilla is offline Offline
1 posts
since Jul 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: should i learn asp.net?
Next Thread in ASP.NET Forum Timeline: Voice Recorder





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC