Cascading Dropdown Getting Error Not all code return value
<p>I have two dropdown. and I am using Cascading dropdown.My First dropdown is returning result on click of selected data from 1st dropdown it is showing no records for those dont have value. But for selected data which has related data its showing method error. can anybody suggest whats the problem? While In sql server I am getting answer values. DD_Issue is view and tape_master is table in database.</p>

<p>Webservice:-</p>

<p>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Specialized;
using System.Web.Script.Services;
using AjaxControlToolkit;
using System.Diagnostics;</p>

<p>/// 
/// Summary description for TapeWebService
/// 
/// 
/// </p>

<p>[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]</p>

<p>// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]</p>

<p>public class TapeWebService : System.Web.Services.WebService
{
    SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["kk"].ToString());</p>

<pre><code>DataSet ds;
IssueReturn ir;
SqlCommand cmd;
SqlDataAdapter sda;
public TapeWebService()
{

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
}
[ScriptMethod]
[WebMethod]
public AjaxControlToolkit.CascadingDropDownNameValue[] FillTape(string knownCategoryValues,string category)
    {
        try
        {
            con.Open();
            cmd = new SqlCommand("Select id, t_code from tape_master", con);
            cmd.ExecuteNonQuery();
            sda = new SqlDataAdapter(cmd);
            ds = new DataSet();
            sda.Fill(ds);
            con.Close();
            List&lt;AjaxControlToolkit.CascadingDropDownNameValue&gt; Tape = new List&lt;AjaxControlToolkit.CascadingDropDownNameValue&gt;();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                string TapeID = Convert.ToString( dr["id"].ToString());
                string TapeName = dr["t_code"].ToString();
                Tape.Add(new AjaxControlToolkit.CascadingDropDownNameValue(TapeName, TapeID));
            }
            return Tape.ToArray();
        }
        catch (Exception e)
        { 

            string message = e.Message;
            HttpContext.Current.Response.Write(e.Message);
        }
}
[ScriptMethod]
[WebMethod]
public AjaxControlToolkit.CascadingDropDownNameValue[] FillTapeCode(string knownCategoryValues, string category)
{
    try
    {
      string TapeID;
        StringDictionary Tape = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
        TapeID = Convert.ToString(Tape["Tape"]);
        con.Open();
        cmd = new SqlCommand("Select * from DD_Issue where tapetype='" + TapeID + "'", con);
        cmd.Parameters.AddWithValue("id", TapeID);
        cmd.ExecuteNonQuery();
        sda = new SqlDataAdapter(cmd);
        ds = new DataSet();
        sda.Fill(ds);
        con.Close();
        List&lt;AjaxControlToolkit.CascadingDropDownNameValue&gt; Code = new List&lt;AjaxControlToolkit.CascadingDropDownNameValue&gt;();
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            string TapeCodeID = Convert.ToString(dr["id"].ToString());
            string TapeCodeName = dr["fill"].ToString();
            Code.Add(new AjaxControlToolkit.CascadingDropDownNameValue(TapeCodeName, TapeCodeID));
        }
        return Code.ToArray();
    }
    catch(Exception e)
    {
        string message = e.Message;
        HttpContext.Current.Response.Write(e.Message);
    }
}
</code></pre>

<p>.Aspx page:-</p>

<pre><code>&lt;asp:DropDownList ID="DdlTapeType" runat="server" Width="140px" 
                                                                        Height="22px"&gt;
                                                                    &lt;/asp:DropDownList&gt;

                                                                   &lt;ajaxToolkit:CascadingDropDown ID="CascadingDDtape" runat="server" Category="Tape"
                                                          TargetControlID="DdlTapeType" LoadingText="[Loading ...]"
                                                           PromptText="Please select a Tape" 
                                                ServicePath="TapeWebService.asmx" ServiceMethod="FillTape"&gt;

                                                                    &lt;/ajaxToolkit:CascadingDropDown&gt; 

                                                                &lt;/td&gt;
                                                                &lt;td class="style31"&gt;
                                                                    &amp;nbsp;&lt;asp:DropDownList ID="DdlTapeCode" runat="server" 
                                                                        Height="22px" 
                                                                        Width="317px" &gt;
                                                                    &lt;/asp:DropDownList&gt;

                                                                     &lt;ajaxToolkit:CascadingDropDown ID="CascadingDDCode" runat="server" 
                                                        TargetControlID="DdlTapeCode" LoadingText="[Loading ...]"
                                                        PromptText="Please select a Code" EmptyText="No Records" ServicePath="TapeWebService.asmx" 
                                                        ServiceMethod="FillTapeCode" Category="Code" ParentControlID="DdlTapeType"&gt;
                                                                    &lt;/ajaxToolkit:CascadingDropDown&gt;
</code></pre>
