Reputation: 259
Initialization of the control is as:
<asp:DropDownList ID="ddlStudent" runat="server" OnSelectedIndexChanged="ddlStudent_SelectedIndexChanged" AutoPostBack="true" CssClass="form-control" data-toggle="tooltip" ToolTip="Select student" />
Here is the VB code for SelectedIndexChanged event(in VB):
Public Sub ddlStudent_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlStudent.SelectedIndexChanged
Dim dsStudentInfo as DataSet = New DataSet()
If (ddlStudent.SelectedIndex > 0) Then
dsStudentInfo = GetStudentInfo(Convert.ToInt32(ddlStudent.SelectedItem.Value))
End If
End Sub
When we reset the drop-down index using JQuery, it resets the dropdown index. And again when we select the previous index, it doesn't trigger server side SelectedIndexChanged event.
Here is the JQuery code to reset the dropdown:
$("[id*=ddlStudent]").prop('selectedIndex', 0);
Here is the demonstration:
NOTE: I have already tried with the following but it didn't work: 1. set dropdown "AutoPostBack" property to true 2. __doPostBack("<%=ddlStudent.ClientID %>", '');
Kindly help in finding the solution.
Upvotes: 1
Views: 292