Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

CascadingDropDown fires change event on page reload

$
0
0

We have used the CascadingDropDown for drop downs to populate. When postback happens, the client side change event of the dropdown is fired automatically. This is Firefox 65 specific behavior. In chrome this event is fired only when user manually selects the value from dropdown. Can anyone help me to fix this issue?

Here is the code.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CS.aspx.cs" Inherits="CS" EnableEventValidation="false" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><title></title><style type="text/css">
        body
        {
            font-family: Arial;
            font-size: 10pt;
        }</style><script type="text/javascript">$(document).ready(function () {$("#<%=ddlCities.ClientID%>").change(function () {
                alert("");
            });
        });</script></head><body><form id="form1" runat="server"><cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager><table><tr><td style="width: 80px">
                Country:</td><td><asp:DropDownList ID="ddlCountries" runat="server" Width="150"></asp:DropDownList><cc1:CascadingDropDown ID="cdlCountries" TargetControlID="ddlCountries" PromptText="Select Country"
                    PromptValue="" ServicePath="ServiceCS.asmx" ServiceMethod="GetCountries" runat="server"
                    Category="CountryId" LoadingText="Loading..." EnableAtLoading="false" /><asp:Button ID ="btn1" runat="server" OnClick="btn1_Click" Text="Submit" /></td></tr><tr><td>
                State:</td><td><asp:DropDownList ID="ddlStates" runat="server" Width="150"></asp:DropDownList><cc1:CascadingDropDown ID="cdlStates" TargetControlID="ddlStates" PromptText="Select State"
                    PromptValue="" ServicePath="ServiceCS.asmx" ServiceMethod="GetStates" runat="server"
                    Category="StateId" ParentControlID="ddlCountries" LoadingText="Loading..." EnableAtLoading="false"/></td></tr><tr><td>
                City:</td><td><asp:DropDownList ID="ddlCities" runat="server" Width="150"></asp:DropDownList><cc1:CascadingDropDown ID="cdlCities" TargetControlID="ddlCities" PromptText="Select City"
                    ServicePath="ServiceCS.asmx" ServiceMethod="GetCities" runat="server"
                    Category="CityId" ParentControlID="ddlStates" /></td></tr></table></form></body></html>
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class CS : System.Web.UI.Page
{
   protected void Page_Load(object sender, EventArgs e)
   {
       
   }
   protected void btn1_Click(object sender, EventArgs e)
   {
       cdlCountries.SelectedValue = "2";
       cdlStates.SelectedValue = "4";
   }
}


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>