Foros del Web » Programando para Internet » ASPX (.net) »

Cascading Drop Down método Error 500

Estas en el tema de Cascading Drop Down método Error 500 en el foro de ASPX (.net) en Foros del Web. Buenas tardes señores, Acudo a ustedes por que le he dado vueltas al siguiente tema y no he dado con el problema, Tengo un par ...
  #1 (permalink)  
Antiguo 23/06/2010, 17:34
 
Fecha de Ingreso: marzo-2010
Mensajes: 21
Antigüedad: 14 años
Puntos: 0
Cascading Drop Down método Error 500

Buenas tardes señores,

Acudo a ustedes por que le he dado vueltas al siguiente tema y no he dado con el problema, Tengo un par de dropdownlist que se llenan atravez de la base de datos utilizando el componente Cascading Drop Down de ajax control tool kit, el tema funciona sin importar la cantidad de dropdownlist que ponga en cascada los valores me los trae correctamente, el porblema es cuando en la base de datos se encuentra con una cantidad x registros el segundo dropdownlist deberia mostar esos registros deacuerdo a el valor del primero pero en ese momento me genera método Error 500 solo cuando soy varios registros, por ejemplo si en la base solo se encuentran 5 registros el los trae sin problema, Pensaria yo que el tema esta en mi web service cuando llamo los valores para llenar mi segundo drowdownlist,
cuando la longitud de datos q debe traer es muy grande pensaria yo q es donde poseo problemas, (me devuelve null nada 0)


Cita:
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(k nownCategoryValues)
Dim ubicacio As Integer
If ((Not kv.ContainsKey("ciudad")) Or (Not Int32.TryParse(kv("ciudad"), ubicacio))) Then
Return Nothing
End If
Dim ubicacion1 As New dsubicacionTableAdapters.ubi_sucursalTableAdapter
Dim valorubicacion As New List(Of CascadingDropDownNameValue)()
For Each row As DataRow In ubicacion1.Getubicacion(ubicacio)
valorubicacion.Add(New CascadingDropDownNameValue(row("desc_sucursal").To String(), row("ubiid_sucursal").ToString()))
Next
Return valorubicacion.ToArray()
hice un ejemplo pequeño con mi problema les copio algo del codigo haber si me pueden colaborar,

Web Service




Cita:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports AjaxControlToolkit
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections.Generic

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()> _
<System.Web.Script.Services.ScriptService()> _
Public Class CarsService
Inherits System.Web.Services.WebService

<WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Function ciudad(ByVal knownCategoryValues As String, ByVal category As String) As AjaxControlToolkit.CascadingDropDownNameValue()
Dim ciudades As New dsciudadesTableAdapters.ubi_ciudadTableAdapter
Dim valoresciudad As New List(Of CascadingDropDownNameValue)()
For Each row As DataRow In ciudades.Getsolociudades
valoresciudad.Add(New CascadingDropDownNameValue(row("desc_ciudad").ToSt ring(), row("ubiid_ciudad").ToString()))
Next
Return valoresciudad.ToArray()
End Function
<WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Function ubicacion(ByVal knownCategoryValues As String, ByVal category As String) As AjaxControlToolkit.CascadingDropDownNameValue()
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(k nownCategoryValues)
Dim ubicacio As Integer
If ((Not kv.ContainsKey("ciudad")) Or (Not Int32.TryParse(kv("ciudad"), ubicacio))) Then
Return Nothing
End If
Dim ubicacion1 As New dsubicacionTableAdapters.ubi_sucursalTableAdapter
Dim valorubicacion As New List(Of CascadingDropDownNameValue)()
For Each row As DataRow In ubicacion1.Getubicacion(ubicacio)
valorubicacion.Add(New CascadingDropDownNameValue(row("desc_sucursal").To String(), row("ubiid_sucursal").ToString()))
Next
Return valorubicacion.ToArray()
End Function
End Class

Aca parece que el tema funciona por q los valores los trae correctamente desde unos dataset que he creado, aca agrego el ASPX


Cita:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!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>Página sin título</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager id="ScriptManager1" runat="server">
</asp:ScriptManager><br />
<br />
<asp:DropDownList ID="ddlciudad" runat="server" Font-Names="Arial" meta:resourcekey="ddlciudadResource1"
Width="264px">
</asp:DropDownList><br />
<asp:DropDownList ID="ddlubi" runat="server" Font-Names="Arial"
meta:resourcekey="ddlubiResource1"
Width="264px">
</asp:DropDownList><br />
<br />
<ajaxToolkit:cascadingdropdown id="ccdciudad" runat="server" behaviorid="ccdciudad" category="ciudad"
enabled="True" loadingtext="Espere Un momento.." prompttext="Seleccione Ciudad."
servicemethod="ciudad" servicepath="CarsService.asmx" targetcontrolid="ddlciudad">
</ajaxToolkit:cascadingdropdown>
<ajaxToolkit:cascadingdropdown id="cddsucursal" runat="server" behaviorid="cddsucursal" category="ubicacion"
enabled="True" loadingtext="Espere Un momento.." parentcontrolid="ddlciudad"
prompttext="Seleccione Ubicacion." servicemethod="ubicacion" servicepath="CarsService.asmx"
targetcontrolid="ddlubi"></ajaxToolkit:cascadingdropdown>
&nbsp;&nbsp;</div>
</form>
</body>
</html>
Por si las moscas jeje aca les dejo las tablas de la DB

Cita:
create table ubi_ciudad

(
ubiid_ciudad integer IDENTITY (300,1),
desc_ciudad varchar (40) not null,
id_zona integer not null,
constraint PK_ubi_ciudad primary key (ubiid_ciudad),
constraint FK_ubi_ciudad foreign key (id_zona) references ubi_zona(ubiid_zona)
);
create table ubi_sucursal
(
ubiid_sucursal integer identity (10000,1),
c_costos varchar (30) UNIQUE not null,
id_ciudad integer not null,
desc_sucursal varchar (100) not null,
direccion varchar (80) null,
no_ext varchar (40) null,
grup_preservicio varchar (2) not null,
constraint PK_ubi_sucursal primary key (ubiid_sucursal),
constraint FK_ubi_sucursal foreign key (id_ciudad) references ubi_ciudad (ubiid_ciudad)
);

Última edición por jam_v; 23/06/2010 a las 17:58

Etiquetas: drop, aspx
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:36.