Hi
I'm using .NET with the Ajax Control Toolkit, and I'm trying to get working the CascadingDropDown control.
Unforunately, to get it working via a SQL database like I need it to, it needs to use a webservice... and this is a new thing for me.
In VS I've created a .ASMX file (the web service file), and I've copied most of the code from a tutorial I'm following here.
My question is what do I put in as the namespace?
I'm confused by this... My webservice code I've got so far is below:-
I'm using .NET with the Ajax Control Toolkit, and I'm trying to get working the CascadingDropDown control.
Unforunately, to get it working via a SQL database like I need it to, it needs to use a webservice... and this is a new thing for me.
In VS I've created a .ASMX file (the web service file), and I've copied most of the code from a tutorial I'm following here.
My question is what do I put in as the namespace?
I'm confused by this... My webservice code I've got so far is below:-
Code:
<%@ WebService Language="C#" Class="pduk" %>
using System;
using System.Web;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web.Services;
using System.Web.Services.Protocols;
using AjaxControlToolkit;
using System.Data;
using System.Data.SqlClient;
using pdukdataTableAdapters;
[WebService(Namespace = "what goes here?")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ProductData : System.Web.Services.WebService
{
public ProductData()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public CascadingDropDownNameValue[] GetSubProducts(
string knownCategoryValues,
string category)
{
pdukdataTableAdapters.pduk_fetchSubProductsTableAdapter SubProducts =
new pdukdataTableAdapters.pduk_fetchSubProductsTableAdapter();
pdukdata.pduk_fetchSubProductsDataTable subproducts = SubProducts.GetSubProducts(1);
//CarsTableAdapters.MakeTableAdapter makeAdapter = new CarsTableAdapters.MakeTableAdapter();
//Cars.MakeDataTable makes = makeAdapter.GetMakes();
List<CascadingDropDownNameValue> values =
new List<CascadingDropDownNameValue>();
foreach (DataRow dr in subproducts)
{
string strSubProductName = (string)dr["name"];
int intSubProductUID = (int)dr["subproduct_uid"];
values.Add(new CascadingDropDownNameValue(strSubProductName,intSubProductUID.ToString()));
}
return values.ToArray();
}
}