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: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" 
<asp:ListItem Selected="false" Text="Select" Value="0"></asp:ListItem>
</asp:DropDownList>

Recommended Answers

All 9 Replies

Whats your code for capturing the change on the dropdown?

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

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.

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...

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.

PS - Otherwise you could be searching the net for days

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.

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.

Make sure that the AutoPostBack Property is set to True on your Dropdownlist control.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.