Tabla cirugia : cir_id | cir_nombre
paquetes_cirugia : paq_id | paq_cir_id | paq_nombre
El asunto es que he estado hasiendo un CascadingDropDown en C# y me tira un error : [Metothod error 500] en el segundo DrownDown
Este es el cod:
[hide]
Código:
[/hide]<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <!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>Cirugias</title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> Cirugias: <asp:DropDownList ID="ddlCirugias" runat="server" DataSourceID="ods_cirugias" DataTextField="cir_nombre" DataValueField="cir_id"> </asp:DropDownList><asp:ObjectDataSource ID="ods_cirugias" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetAllCirugias" TypeName="dsCirugiasTableAdapters.CirugiasTableAdapter"></asp:ObjectDataSource> <br /><br /> Paquetes: <asp:DropDownList ID="ddlCirugiaPaquetes" runat="server"> </asp:DropDownList><br /><br /> <ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server" Category="Cirugias" LoadingText="Please wait..." ParentControlID="ddlCirugias" PromptText="Select a model" TargetControlID="ddlCirugiaPaquetes" ServicePath="CirugiasService.asmx" ServiceMethod="GetPaquetesByCirugias" /> </div> </form> </body> </html>
y este es el webservice.
[hide]
Código:
[/hide]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; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class CirugiasService : System.Web.Services.WebService { public CirugiasService () { } [WebMethod] public CascadingDropDownNameValue[] GetPaquetesByCirugias(string knownCategoryValues, string category) { string[] _categoryValues = knownCategoryValues.Split(':', ';'); int _cir_id = Convert.ToInt32(_categoryValues[1]); List<CascadingDropDownNameValue> _cirugiaPaquetes = new List<CascadingDropDownNameValue>(); dsCirugiaPaquetesTableAdapters.PaquetesTableAdapter _cirugiaPaqueteAdapter = new dsCirugiaPaquetesTableAdapters.PaquetesTableAdapter(); foreach (DataRow _row in _cirugiaPaqueteAdapter.GetPaquetesByCirugias(_cir_id)) { _cirugiaPaquetes.Add(new CascadingDropDownNameValue(_row["paq_nombre"].ToString(), _row["paq_id"].ToString())); } return _cirugiaPaquetes.ToArray(); } }
Ojala me puedan Hechar una mano, de antemano gracias :D