Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

Method error 500


I am trying cascadingdropdown with ajax control.  On my form i add 1
combobox and the cascadingdropdown control.  When I run the page the
combobox displays the Select... and no options except for

[Method Error 500]

Please help me.

Here is my web service code.

using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using AjaxControlToolkit;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for FoodService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]

public class FoodService : System.Web.Services.WebService
{

    public FoodService()
    {

        //Uncomment the following line if using designed components
        //InitializeComponent();
    }

    [WebMethod]
 //   public CascadingDropDownNameValue[] GetItemsByCategoryID(string
KnownCategoryValues, string category)
 //   {
 //       string[] _categoryValues = KnownCategoryValues.Split(':',
';');
 //       int _foodID = Convert.ToInt32(_categoryValues[1]);
 //       List<CascadingDropDownNameValue> _foodItems = new
List<CascadingDropDownNameValue>();
 //       dsFoodTableAdapters.tbparentTableAdapter _foodAdapter =
 //new dsFoodTableAdapters.tbparentTableAdapter();

 //       foreach (DataRow _row in _foodAdapter.GetFoodData())
 //       {
 //           _foodItems.Add(new
CascadingDropDownNameValue(_row["category"].ToString(),
_row["categoryID"].ToString()));

 //       }

 //       // convert to array and return the vlaues
 //       return _foodItems.ToArray();
 //   }

    public CascadingDropDownNameValue[] GetItemsByCategoryID(string
KnownCategoryValues)
    {
        string[] _categoryValues = KnownCategoryValues.Split(':',
';');
        int _foodID = Convert.ToInt32(_categoryValues[1]);
        List<CascadingDropDownNameValue> _foodItems = new
List<CascadingDropDownNameValue>();
        //    dsFoodTableAdapters.tbparentTableAdapter _foodAdapter =
        //new dsFoodTableAdapters.tbparentTableAdapter();
        dsFoodItemsTableAdapters.tbChildTableAdapter _foodAdapter =
new dsFoodItemsTableAdapters.tbChildTableAdapter();

        foreach (DataRow _row in _foodAdapter.GetData(_foodID))
        {
            _foodItems.Add(new
CascadingDropDownNameValue(_row["subcategory"].ToString(),
_row["subcategoryID"].ToString()));

        }

        // convert to array and return the vlaues
        return _foodItems.ToArray();
    }

}

#######################################

Below is the code for aspx page

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<%@ 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">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

        <asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="ObjectDataSource1"
            DataTextField="category" DataValueField="categoryID">
        </asp:DropDownList><asp:ObjectDataSource
ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}"
            SelectMethod="GetFoodData"
TypeName="dsFoodTableAdapters.tbparentTableAdapter"></
asp:ObjectDataSource>
        <asp:DropDownList ID="DropDownList2" runat="server">
        </asp:DropDownList><br />
        <cc1:CascadingDropDown ID="CascadingDropDown1" runat="server"
Category="tbChild" LoadingText="please wait"
ParentControlID="DropDownList1" PromptText="please subcategory"
ServiceMethod="GetItemsByCategoryID" TargetControlID="DropDownList2">
        </cc1:CascadingDropDown>
    </form>
</body>
</html>
########################################################

Below is the code for aspx.cs page

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc