I have an asp.net form that contains a drop-down list that is sent back to the server upon change and populates the second drop-down list with several dates.
The form also contains other fields, some of which are verified clients and some servers.
Here is the problem I am having. If I get a client validation error, try changing the drop-down list, the second drop-down list will not be filled. If I change the first drop-down list again, it will work as expected.
Here is my submit button:
<asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClientClick="Page_ClientValidate(); return checkPassengers();" OnClick="Page_Transfer" ValidationGroup="FormSubmit" />
Here is my customer check:
function checkPassengers() {
if($("#testField").val() == "Name *" || $("#testField").val() == "") {
$("#pltester").prepend("<p class='fillall'>Please fill in all fields marked with *</p>");
return false;
}
};
Dropdowns:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl1st" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:DropDownList ID="ddl1st" Width="190" AutoPostBack="true" OnSelectedIndexChanged="ChooseDates1st" runat="server" />
<asp:DropDownList ID="ddlDepart1st" AutoPostBack="true" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
source
share