ajax cascadingdropdown Conversion failed method error 500http://forums.asp.net/t/1798211.aspx/1?ajax+cascadingdropdown+Conversion+failed+method+error+500Thu, 03 May 2012 01:34:28 -040017982114956999http://forums.asp.net/p/1798211/4956999.aspx/1?ajax+cascadingdropdown+Conversion+failed+method+error+500ajax cascadingdropdown Conversion failed method error 500 <p>Hello, I created Ajax cascadingdownload list in my project. It worked fine in my localhost but when deployed it&nbsp;to my university's web server, the method error 500 was shown on page loaded. so the Firebug told me that the error is coming form&nbsp;&quot;Conversion failed when converting the nvarchar value 'BindCategory' to datatype Int.&quot; My code is below:</p> <pre class="prettyprint">&lt;table cellpadding=&quot;2&quot; width=&quot;100%&quot;&gt; &lt;tr&gt; &lt;td style=&quot;height:25px;&quot;&gt; &lt;asp:Label ID=&quot;Label4&quot; runat=&quot;server&quot; CssClass=&quot;LabelTitle&quot; Text=&quot;:&quot;&gt;&lt;/asp:Label&gt; &lt;asp:DropDownList ID=&quot;DDLCatName&quot; runat=&quot;server&quot; CssClass=&quot;DDLText&quot;&gt;&lt;/asp:DropDownList&gt; &lt;asp:CascadingDropDown ID=&quot;CCCatName&quot; runat=&quot;server&quot; Category=&quot;CategoryName&quot; TargetControlID=&quot;DDLCatName&quot; PromptText=&quot;----&quot; LoadingText=&quot;Loading Categories..&quot; ServiceMethod=&quot;BindCategory&quot; ServicePath=&quot;CascadingDropdown.asmx&quot;&gt; &lt;/asp:CascadingDropDown&gt; &lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator1&quot; runat=&quot;server&quot; ControlToValidate=&quot;DDLCatName&quot; CssClass=&quot;failureNotification&quot; ErrorMessage=&quot;&quot; &gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;height:25px;&quot;&gt; &lt;asp:Label ID=&quot;Label5&quot; runat=&quot;server&quot; CssClass=&quot;LabelTitle&quot; Text=&quot;:&quot;&gt;&lt;/asp:Label&gt; &lt;asp:DropDownList ID=&quot;DDLSubCatName&quot; runat=&quot;server&quot; CssClass=&quot;DDLText&quot;&gt;&lt;/asp:DropDownList&gt; &lt;asp:CascadingDropDown ID=&quot;ccdSubCatName&quot; runat=&quot;server&quot; Category=&quot;SubCatName&quot; ParentControlID=&quot;DDLCatName&quot; TargetControlID=&quot;DDLSubCatName&quot; PromptText=&quot;----&quot; LoadingText=&quot;Loading Sub Category..&quot; ServiceMethod=&quot;BindSubCategory&quot; ServicePath=&quot;CascadingDropdown.asmx&quot;&gt; &lt;/asp:CascadingDropDown&gt; &lt;asp:RequiredFieldValidator ID=&quot;RequiredFieldValidator2&quot; runat=&quot;server&quot; ControlToValidate=&quot;DDLSubCatName&quot; CssClass=&quot;failureNotification&quot; ErrorMessage=&quot;&quot; &gt;&lt;/asp:RequiredFieldValidator&gt; &lt;/td&gt; &lt;/tr&gt;</pre> <p>Webservice Code:</p> <pre class="prettyprint">using System.Data; using System.Web.Services; using System.Collections.Generic; using System.Collections.Specialized; using AjaxControlToolkit; using System.Configuration; using System.Data.SqlClient; using System.Web.Script.Services; /// &lt;summary&gt; /// Summary description for CascadingDropdown /// &lt;/summary&gt; [ScriptService] [WebService(Namespace = "http://tempuri.org/")] //[WebService(Namespace = "http://www.stou.ac.th/Offices/ore/rere/goto/HelpDeskAdmin/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] //[System.Web.Script.Services.ScriptService] //[System.Web.Script.Services.ScriptService()] public class CascadingDropdown : System.Web.Services.WebService { [WebMethod] public CascadingDropDownNameValue[] BindCategory(string knownCategoryValues, string category) { SqlConnection concatname = new SqlConnection(ConfigurationManager.ConnectionStrings["OREConnectionString"].ConnectionString); concatname.Open(); SqlCommand cmdcatname = new SqlCommand("select * from HelpDeskCat where IsActive = 1", concatname); SqlDataAdapter dacatname = new SqlDataAdapter(cmdcatname); cmdcatname.ExecuteNonQuery(); DataSet dscatanme = new DataSet(); dacatname.Fill(dscatanme); concatname.Close(); List&lt;CascadingDropDownNameValue&gt; catnamedetails = new List&lt;CascadingDropDownNameValue&gt;(); foreach (DataRow dtrow in dscatanme.Tables[0].Rows) { string CatID = dtrow["txtcatid"].ToString(); string CatName = dtrow["CatName"].ToString(); catnamedetails.Add(new CascadingDropDownNameValue(CatName, CatID)); } return catnamedetails.ToArray(); } [WebMethod] public CascadingDropDownNameValue[] BindSubCategory(string knownCategoryValues, string category) { Int32 CatID; //string CatID; StringDictionary subcatdetails = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues); CatID = Convert.ToInt32(subcatdetails["CategoryName"]); //CatID = subcatdetails["CategoryName"]; SqlConnection consubcat = new SqlConnection(ConfigurationManager.ConnectionStrings["OREConnectionString"].ConnectionString); consubcat.Open(); SqlCommand cmdsubcat = new SqlCommand("select * from HelpDeskSubCat where catid = @catid", consubcat); cmdsubcat.Parameters.Add("@catid", SqlDbType.Int).Value = CatID; //cmdsubcat.Parameters.AddWithValue("@txtcatid", CatID); cmdsubcat.ExecuteNonQuery(); SqlDataAdapter dasubcat = new SqlDataAdapter(cmdsubcat); DataSet dsstate = new DataSet(); dasubcat.Fill(dsstate); consubcat.Close(); List&lt;CascadingDropDownNameValue&gt; statedetails = new List&lt;CascadingDropDownNameValue&gt;(); foreach (DataRow dtstaterow in dsstate.Tables[0].Rows) { string subcatID = dtstaterow["subcatid"].ToString(); string SubCatname = dtstaterow["subcatname"].ToString(); statedetails.Add(new CascadingDropDownNameValue(SubCatname, subcatID)); } return statedetails.ToArray(); } } </pre> <p><br> I wonder why the error is only appear when deploy that project on the Server. I try to find out the answers form google but no luck. Why different environment made my project error. Please give me an advise to solve this problem, Thanks</p> 2012-04-29T14:41:40-04:004957016http://forums.asp.net/p/1798211/4957016.aspx/1?Re+ajax+cascadingdropdown+Conversion+failed+method+error+500Re: ajax cascadingdropdown Conversion failed method error 500 <p>have you installed ajax on iis</p> 2012-04-29T14:58:59-04:004957198http://forums.asp.net/p/1798211/4957198.aspx/1?Re+ajax+cascadingdropdown+Conversion+failed+method+error+500Re: ajax cascadingdropdown Conversion failed method error 500 <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Shoaib Rasheed</h4> have you installed ajax on iis</blockquote> <p></p> <p>Thanks for reply. I've uploaded Ajax ControlToolKit in my Bin Directory. Do it need to install into web server?</p> <p></p> 2012-04-29T21:58:11-04:004957313http://forums.asp.net/p/1798211/4957313.aspx/1?Re+ajax+cascadingdropdown+Conversion+failed+method+error+500Re: ajax cascadingdropdown Conversion failed method error 500 &lt;div sizcache=&quot;2&quot; sizset=&quot;20&quot;&gt; <p>Hi,</p> <p>There are three reasons can cause error 500.</p> <p>1. In WebService add attribute [System.Web.Script.Services.ScriptService()] to class. 2. If you use another asp controls in the same aspx page add in <br> 3. If yet you get error - try ValidateRequest=&quot;false&quot; in the tag</p> <p>Please check the following link about this error: <a href="http://www.benhblog.com/2008/09/method-error-500-and-ajax.html"> http://www.benhblog.com/2008/09/method-error-500-and-ajax.html</a></p> <p>Please refer to this <a href="http://forums.asp.net/t/1198016.aspx#faq02">faq </a> which tells you how to locate the cause. It's usually much easier to find it our in your practical environment.</p> &lt;/div&gt; 2012-04-30T03:14:44-04:004960987http://forums.asp.net/p/1798211/4960987.aspx/1?Re+ajax+cascadingdropdown+Conversion+failed+method+error+500Re: ajax cascadingdropdown Conversion failed method error 500 <p>Hi,</p> <p>Do you publish the web site correctly with VS2010? And make sure the&nbsp;IIS server select the correct version asp.net. And also make sure the ajaxcontroltoolkit.dll is copied to the server.</p> 2012-05-02T06:39:32-04:004961479http://forums.asp.net/p/1798211/4961479.aspx/1?Re+ajax+cascadingdropdown+Conversion+failed+method+error+500Re: ajax cascadingdropdown Conversion failed method error 500 <p>Sorry I never told you that everything worked fine until Monday 23, the server was down because of blackout. The server can't bootup, so the technician guys reinstalled ws 08 and re-configured IIS but it is not be the same. My app can't run smoothly as I mentioned above. I don't know why. Right now, my app can't run. There are 2 errors occured one is <span face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif " style="font-family:Arial,Helvetica,Geneva,SunSans-Regular,sans-serif"> AccessFile is not valid</span> and the second is 404 - File or directory not found when retrieved the page that use URL routing. If the application pool enable 32bit to true, my app can run without the error of valid Accessfile. but it still got an error of URL routing. Can I solve this problem.</p> 2012-05-02T10:15:38-04:004962760http://forums.asp.net/p/1798211/4962760.aspx/1?Re+ajax+cascadingdropdown+Conversion+failed+method+error+500Re: ajax cascadingdropdown Conversion failed method error 500 <p>Hi,</p> <p>I think this is not ajax problem, maybe IIS or you publish not correctly. Please check again.</p> 2012-05-03T01:34:28-04:00