473,378 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Ajax Problem

Hi Phani,

I have two tables. I created datasets dsPrimary and dsChild. For
dsPrimary.xsd my query is For first dropdown list my query is select
* from tbparent

For second dataset dsChild.xsd my query is
select categoryid, subcategoryid, subcategory
from tbchild where categoryid = @categoryid.

I Created an ObjectDataSource to display all the Items from tbparent
table available in the first dropdownlist . By default all the
parentitems available in tbparent table will be shown when the page
loads.

My problem is when I call a web method from my web service to populate
the second dropdown list based on the item choosen from first dropdown
list. It shows Method Error 505 instead of showing the items from the
tbChild table.

I am sending you all my cs and asmx files so, that you can have a look
on that.

I am following this link for tutorial
http://aspalliance.com/1183_Creating...own_Using_AJAX.

I appreciate your help

tbparent
categoryID category
----------- -------------
1 fruits
2 vegetables
3 meats

tbChild
categoryID subcategoryID subcategory
----------- ------------- -------------
1 1 apple
1 2 orange
1 3 banana
2 4 brocoli
2 5 celery
2 6 squash
3 7 ham
3 8 turkey
3 9 chicken

################################################## ##############
Here is my web service

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[] GetChildData(string
KnownCategoryValues, string category)
{
string[] _categoryValues = KnownCategoryValues.Split(':',
';');
int _foodID = Convert.ToInt32(_categoryValues[1]);
List<CascadingDropDownNameValue_foodItems = new
List<CascadingDropDownNameValue>();

dsChildTableAdapters.tbChildTableAdapter _foodAdapter = new
dsChildTableAdapters.tbChildTableAdapter();

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

}

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

################################################## ##################
Here is my Default.aspx page

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

<%@ Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/
TR/xhtml11/DTD/xhtml11.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" />
<div>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="ObjectDataSource1"
DataTextField="category" DataValueField="categoryID"
Width="220px">
</asp:DropDownList><asp:ObjectDataSource
ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetParentData"
TypeName="dsPrimaryTableAdapters.tbparentTableAdap ter"
UpdateMethod="Update">
<DeleteParameters>
<asp:Parameter Name="Original_categoryID"
Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="category" Type="String" />
<asp:Parameter Name="Original_categoryID"
Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="category" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<br />
<asp:DropDownList ID="DropDownList2" runat="server"
Width="221px">
</asp:DropDownList><br />
&nbsp;<cc1:CascadingDropDown ID="CascadingDropDown1"
runat="server" Category="category"
LoadingText="please select"
ParentControlID="DropDownList1" PromptText="please select"
ServiceMethod="GetItemsByCategoryID"
TargetControlID="DropDownList2">
</cc1:CascadingDropDown>
</div>
</form>
</body>
</html>

May 30 '07 #1
0 961

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
31
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
5
by: Martin | last post by:
Hello NG, I've been doing some AJAX for a few weeks now. The basics worked fine so far, but now I've got the following problem which I can't solve: With AJAX you typically update/replace only...
3
by: Alok yadav | last post by:
I have an open IP and on that IP our main application is hosted. it uses ajax. in web.config file i have register ajax handlers. there are also other sites or project on that IP. now my problem is...
3
by: equazcion | last post by:
Hi, I have an image reference (IMG) in my page that changes depending on the value of a database field. Clicking the image triggers an Ajax call to change the database field (toggles the field...
7
by: tommurray | last post by:
Hi all Hope someone can help with the problem I am having as it is driving me nuts! I have the below script on my site the problem lies with passing through a url parameter in the below line...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
2
by: shivendravikramsingh | last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if...
3
by: willl69 | last post by:
Hi All, Ive been having a problem of late with one of my sites that uses PHP5 / Ajax. The problem is that periodically the ajax functions lock up and it gets stuck in the loading phase of the...
2
by: majidtou | last post by:
Hi , We have an HTML page which is using AJAX. We make an AJAX call which retrieves a table with mutiple rows. We need to extend this functionality. In the table, we want to put a button on each...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.