Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:38:03+00:00 2026-05-23T09:38:03+00:00

I have two dropdown. and I am using Cascading dropdown.My First dropdown is returning

  • 0

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.

Webservice:-

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;

///
/// Summary description for TapeWebService
///
///
///

[WebService(Namespace = “http://tempuri.org/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]

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

public class TapeWebService : System.Web.Services.WebService
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings[“kk”].ToString());

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<AjaxControlToolkit.CascadingDropDownNameValue> Tape = new List<AjaxControlToolkit.CascadingDropDownNameValue>();
            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<AjaxControlToolkit.CascadingDropDownNameValue> Code = new List<AjaxControlToolkit.CascadingDropDownNameValue>();
        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);
    }
}

.Aspx page:-

<asp:DropDownList ID="DdlTapeType" runat="server" Width="140px" 
                                                                        Height="22px">
                                                                    </asp:DropDownList>

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

                                                                    </ajaxToolkit:CascadingDropDown> 

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

                                                                     <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">
                                                                    </ajaxToolkit:CascadingDropDown>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:38:04+00:00Added an answer on May 23, 2026 at 9:38 am

    You are getting this error because there is no return statement in catch block. You have given return in Try {} only, include return in catch also.

    public AjaxControlToolkit.CascadingDropDownNameValue[] FillTape(string knownCategoryValues,string category)
        {
     List<AjaxControlToolkit.CascadingDropDownNameValue> Tape = new List<AjaxControlToolkit.CascadingDropDownNameValue>();
            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();
    
                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));
                }
    
            }
            catch (Exception e)
            { 
    
                string message = e.Message;
                HttpContext.Current.Response.Write(e.Message);
            }
    return Tape.ToArray();
    }
    [ScriptMethod]
    [WebMethod]
    public AjaxControlToolkit.CascadingDropDownNameValue[] FillTapeCode(string knownCategoryValues, string category)
    {
         List<AjaxControlToolkit.CascadingDropDownNameValue> Code = new List<AjaxControlToolkit.CascadingDropDownNameValue>();
        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();
    
            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));
            }
    
        }
        catch(Exception e)
        {
            string message = e.Message;
            HttpContext.Current.Response.Write(e.Message);
        }
     return Code.ToArray();
    }
    

    Thanks
    Ashwani

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with two buttons. The first is hidden using Javascript. When
I have cascading data-bound combo boxes, however, if the second of the two boxes
I have a page with two ContentPlaceHolders. One has a DropDown and another UpdatePanel
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
I have two applications written in Java that communicate with each other using XML
I have two arrays of System.Data.DataRow objects which I want to compare. The rows
I have two identical tables and need to copy rows from table to another.
I have two dropdown lists, one containing a list of countries and one for
I have two dropdown lists: <asp:DropDownList ID=Field_Type runat=server /> <asp:DropDownList ID=Field_SubType runat=server /> Field_Type
I have two dropdowns in my form. The first one Queries for a set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.