Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# AJAX中CascadingDropDownExtender的方法错误500_C#_Ajax - Fatal编程技术网

C# AJAX中CascadingDropDownExtender的方法错误500

C# AJAX中CascadingDropDownExtender的方法错误500,c#,ajax,C#,Ajax,我正在AJAX中开发CascadingDropDownExtender。当我运行示例时,我在下拉列表中得到“[Method Error 500]”。我编写了一个Web服务(carService.asmx)来从XML(carService.XML)中获取下拉列表中的值。甚至Web服务也没有正确调用。当我运行Web服务时,会生成一个带有错误的XML。请帮我解决这个问题。谢谢。开始调试您的Web服务。看来这就是问题所在。看看这篇微软的文章:回答有点晚,但它可以帮助其他人 我有一个类似的问题,但最初我得

我正在AJAX中开发CascadingDropDownExtender。当我运行示例时,我在下拉列表中得到“[Method Error 500]”。我编写了一个Web服务(carService.asmx)来从XML(carService.XML)中获取下拉列表中的值。甚至Web服务也没有正确调用。当我运行Web服务时,会生成一个带有错误的XML。请帮我解决这个问题。谢谢。

开始调试您的Web服务。看来这就是问题所在。看看这篇微软的文章:

回答有点晚,但它可以帮助其他人

我有一个类似的问题,但最初我得到一个“方法错误415”,然后是“方法错误500”。我建议您检查Web服务的绑定

我意识到,我意外地将该服务添加为支持Silverlight的服务,而不是支持AJAX的服务。最后,我在web.config中重做了服务绑定,这导致了“方法错误500”。显然,我错误地修改了服务绑定,结果是重新创建了该服务,但将其作为支持AJAX的服务。事后一切如期进行

附言。 我正在使用WCF服务,但我确信这同样适用于普通的Web服务。

很抱歉回答得太晚,我认为这将有助于将来在ajax Cascade下拉列表中找到此错误,因为错误500已为我解决此错误,因为绑定方法的参数值发生了更改,如下所示
Sorry for late answer  i think this will help in future who w'll get this error in ajax cascadedropdown for error 500 is solved for me this error because of changing parameter values for the binding method as clearly showed below

** Initially **

public CascadingDropDownNameValue[] BindCountrydropdown(string value, string text)
    {
        SqlConnection concountry = new SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
        concountry.Open();
        SqlCommand cmdcountry = new SqlCommand("select * from tbl_Countries", concountry);
        SqlDataAdapter dacountry = new SqlDataAdapter(cmdcountry);
        cmdcountry.ExecuteNonQuery();
        DataSet dscountry = new DataSet();
        dacountry.Fill(dscountry);
        concountry.Close();
        List<CascadingDropDownNameValue> countrydetails = new      List<CascadingDropDownNameValue>();
        foreach(DataRow dtrow in dscountry.Tables[0].Rows)
        {
            string CountryID = dtrow["IDCountry"].ToString();
            string CountryName = dtrow["CountryName"].ToString();
            countrydetails.Add(new CascadingDropDownNameValue(CountryName,CountryID));
        }
        return countrydetails.ToArray();
    }


i got error 500 i found solution because of changing parmeter name in above method solution is given below u must pass parmaters as(knownCategoryValues,category) don't change parameter name

** Solution **
  public CascadingDropDownNameValue[] BindCountrydropdown(string knownCategoryValues, string category)
    {
        SqlConnection concountry = new  SqlConnection(ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
        concountry.Open();
        SqlCommand cmdcountry = new SqlCommand("select * from tbl_Countries", concountry);
        SqlDataAdapter dacountry = new SqlDataAdapter(cmdcountry);
        cmdcountry.ExecuteNonQuery();
        DataSet dscountry = new DataSet();
        dacountry.Fill(dscountry);
        concountry.Close();
        List<CascadingDropDownNameValue> countrydetails = new List<CascadingDropDownNameValue>();
        foreach(DataRow dtrow in dscountry.Tables[0].Rows)
        {
            string CountryID = dtrow["IDCountry"].ToString();
            string CountryName = dtrow["CountryName"].ToString();
            countrydetails.Add(new CascadingDropDownNameValue(CountryName,CountryID));
        }
        return countrydetails.ToArray();
    }

i think this will help for u
**最初** public CascadingDropDownNameValue[]BindCountrydropdown(字符串值,字符串文本) { SqlConnection concountry=新的SqlConnection(ConfigurationManager.ConnectionString[“Connection”].ConnectionString); 联合国开放; SqlCommand cmdcountry=新的SqlCommand(“从tbl_国家中选择*”,concountry); SqlDataAdapter dacountry=新的SqlDataAdapter(cmdcountry); cmdcountry.ExecuteNonQuery(); 数据集dscountry=新数据集(); dacountry.Fill(dscountry); concountry.Close(); List countrydetails=新列表(); foreach(dscountry.Tables[0].Rows中的DataRow dtrow) { 字符串CountryID=dtrow[“IDCountry”].ToString(); 字符串CountryName=dtrow[“CountryName”].ToString(); 添加(新的CascadingDropDownNameValue(CountryName,CountryID)); } return countrydetails.ToArray(); } 我得到了错误500我找到了解决方案,因为在上面的方法中更改了参数名称。下面给出了解决方案。u必须传递参数,因为(knownCategoryValues,category)不更改参数名称 **解决方案** public CascadingDropDownNameValue[]BindCountrydropdown(字符串知识类别值,字符串类别) { SqlConnection concountry=新的SqlConnection(ConfigurationManager.ConnectionString[“Connection”].ConnectionString); 联合国开放; SqlCommand cmdcountry=新的SqlCommand(“从tbl_国家中选择*”,concountry); SqlDataAdapter dacountry=新的SqlDataAdapter(cmdcountry); cmdcountry.ExecuteNonQuery(); 数据集dscountry=新数据集(); dacountry.Fill(dscountry); concountry.Close(); List countrydetails=新列表(); foreach(dscountry.Tables[0].Rows中的DataRow dtrow) { 字符串CountryID=dtrow[“IDCountry”].ToString(); 字符串CountryName=dtrow[“CountryName”].ToString(); 添加(新的CascadingDropDownNameValue(CountryName,CountryID)); } return countrydetails.ToArray(); } 我想这对你有帮助