Laziale Laziale - 1 year ago 134
ASP.NET (C#) Question

html select (dropdown) control selected index changed event in asp.net

I am trying to put backend code to my html select control (dropdown) when the value is changed a backend method to be triggered, but I Can't find the event.
I tried this way:

<select id="ddlCompany" name="select2" onchange="ddlCompany_SelectedIndexChanged" runat="server" class="dropdown nostyle sel1" style="width:100%;" placeholder="Select Company" />


nothing changes.
Can anyone advice how I can fix this?
Thx, Laziale

Answer Source

Try using the SelectedIndexChanged property instead of onchange, like this:

<select id="ddlCompany" name="select2" OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged" runat="server" class="dropdown nostyle sel1" style="width:100%;" placeholder="Select Company" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download