Hello i use ajax with CascadingDropDown for 2 dropdownlist, one parent and the second chield for save this informatio in data base is ok, no problem, the question is when i load this information from database to my aspx, i can put the selected value in the dropdownlist parent was very good, but when y tried to put the select value to the chield i have the problem, the razon is that the chield dropdownlist is no load ... how i can load the chiel dropdown for clien side,, any examples please
for example in the proyect http://www.asp.net/learn/ajax-videos/video-278.aspx i want put one (input button) and using java script to said car = acure , Model = integra, color = blue ,,,, i supose this
<script language="javascript" type="text/javascript">
<!--
function Button1_onclick() {
document.getElementById('ddlMakes').value=1;
document.getElementById('ddlModels').value=2;
document.getElementById('ddlColors').value=3;
}
// -->
</script>but not working, how i can do, please
Juan Carlos Castillo
![]() |
0 |
![]() |
Could we see your code? What ServicePath and ServiceMethod are you using to populate the child?
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
![]() |
0 |
![]() |
Please help my, thanks this is the code that i use for load the dropdowlist when the user click for databind the chield dropdownlist
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="WebS.asmx" /> </Services> </asp:ScriptManager> <table cellpadding="2" cellspacing="2"> <tr> <td> <table class="black" cellpadding="2" cellspacing="2"> <tr> <td>Departamento <br /><br /> <asp:DropDownList ID="cboDepartamentoAfilia" runat="server" CssClass="black"> </asp:DropDownList> <cc1:CascadingDropDown ID="cboDepartamentoAfilia_CascadingDropDown" runat="server" Enabled="True" TargetControlID="cboDepartamentoAfilia" Category="Departamento" PromptText="Seleccione Departamento" LoadingText="Por Favor Espere..." ServicePath="WebS.asmx" ServiceMethod="GetDepartamento" > </cc1:CascadingDropDown> </td> <td>Ciudad <br /><br /> <asp:DropDownList ID="cboCiudadAfilia" runat="server" CssClass="black"> </asp:DropDownList> <cc1:CascadingDropDown ID="cboCiudadAfilia_CascadingDropDown" runat="server" Enabled="True" TargetControlID="cboCiudadAfilia" ParentControlID="cboDepartamentoAfilia" Category="Ciudad" PromptText="Seleccione Ciudad" LoadingText="Por favor Espere..." ServicePath="WebS.asmx" ServiceMethod="GetCiudad_Dep" > </cc1:CascadingDropDown> </td>the webservice is<WebMethod()> _
Public Function GetDepartamento(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
With objConexion
.ConnectionString = objFunction.Cifrado(2, System.Configuration.ConfigurationManager.AppSettings("TARJETA_AZUL"))
dttTemp = .Query("select VDE_NID,VDE_CDESCRIPCION from dbo.TBL_RVENDEDOR_DEPARTAMENTO order by VDE_CDESCRIPCION asc", clsConnection.TipoDato.Table)
End With
Dim makeValues As New List(Of CascadingDropDownNameValue)()
For i = 0 To dttTemp.Rows.Count - 1
makeValues.Add(New CascadingDropDownNameValue(dttTemp.Rows(i).Item("VDE_CDESCRIPCION"), dttTemp.Rows(i).Item("VDE_NID")))
Next i
Return makeValues.ToArray()
End Function
<WebMethod()> _
Public Function GetCiudad_Dep(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
Dim VendorID As Integer
Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
If Not kv.ContainsKey("Departamento") Or Not Int32.TryParse(kv("Departamento"), VendorID) Then
Throw New ArgumentException("No encontro ciudades")
End If
With objConexion
.ConnectionString = objFunction.Cifrado(2, System.Configuration.ConfigurationManager.AppSettings("TARJETA_AZUL"))
dttTemp = .Query("SELECT VCI_NID,VCI_CDESCRIPCION FROM dbo.TBL_RVENDEDOR_CIUDAD WHERE VDE_NID=" + CStr(VendorID), clsConnection.TipoDato.Table)
End With
Dim modelValues As New List(Of CascadingDropDownNameValue)()
For i = 0 To dttTemp.Rows.Count - 1 'carModelAdapter.GetModelsByCarId(makeId)
modelValues.Add(New CascadingDropDownNameValue(dttTemp.Rows(i).Item("VCI_CDESCRIPCION"), dttTemp.Rows(i).Item("VCI_NID")))
Next i
Return modelValues.ToArray()
End Functionthis is the code when i tried to found (search in database) the htmlfunction Button4_onclick() {
ret = WebS.Buscar_Cliente(document.getElementById('ctl00_ContentPlaceHolder1_txtNumeroDoc').value, OnCompleteBusqueda, OnTimeOut, OnError);
}function OnCompleteBusqueda(args)
{ args=args;
var vars = args.vars;
document.getElementById("ctl00_ContentPlaceHolder1_cboDepartamentoAfilia").value =vars[6]; //is okdocument.getElementById("ctl00_ContentPlaceHolder1_cboCiudadAfilia").value=vars[7]; //this is the problemthe webservice is<WebMethod()> _
Public Function Buscar_Cliente(ByVal Documento As String) As ClienteObject
Dim co As New ClienteObject
With objConexion
.ConnectionString = objFunction.Cifrado(2, System.Configuration.ConfigurationManager.AppSettings("SUIM"))
.NameProcedure = "SPR_GET_CLIENTE"
.Parameters("@PI_NOPCION", 0) 'GET
.Parameters("@PI_NID", 0)
.Parameters("@PI_CDOCUMENTO", Documento)
dttTemp = .ExecuteProc(clsConnection.TipoDato.Table)
.DisposeProc()
co.vars(6) = CStr(dttTemp.Rows(0).Item("CLI_CCODDEP_AFILIA"))
co.vars(7) = CStr(dttTemp.Rows(0).Item("CLI_CCODCIU_AFILI"))this pasrt is okplease help my
Juan Carlos Castillo
![]() |
0 |
![]() |
Sorry, but I don't see an update panel there. How do you do your postback?
Have you watched this video?
http://www.asp.net/learn/ajax-videos/video-77.aspx
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
![]() |
0 |
![]() |
ok thanks, maybe my english is not good, but my problem no is the cascading dropdownlist, when the user select one ddlis and the second ddlist is child, no is my problem because i work fine ans save this information in my database, and not use updatepanel, the problem is when i search (found) this information for database and show this in ddlist because i selected value the ddlist parent ok , but i need databind the child ddlist ofr make select value but only javascript clien side
o no pelase help my i need, finish one formulario of search thanks
Juan Carlos Castillo
![]() |
0 |
![]() |
AJAX extenders are designed to be used in update panels. If you have some reason you can't use an update panel I recommend that you use two seperate regular ASP.Net DDLs. When the parent DDL is updated, on the selected index updated event set the datasource for your child DDL to be a SQL query which uses the foreign key on the parent table to select the values from the child table.
For example, on the selected index changed event for the Parent, set a string: theSQL = "SELECT Value, Key from dbo." + ParentDDL.Value " Order By Value"
The following illustrates how to do something like that. Modify it so that you set theSQL on the Parent DDL's selected index changed, the do a postback, and set the Child DataSource to theSQL and bind the child list in the child's PreRender event.
I love to display the non-secure items...
Charlie Asbornsen
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
![]() |
0 |
![]() |
Hi,
May be these threads about the WebService method of the CascadingDropDown are useful:
http://forums.asp.net/t/1274880.aspx
http://forums.asp.net/t/1319523.aspx
http://forums.asp.net/t/1334592.aspx
Use ASP.NET AJAX Cascading Drop Down Control to Access a Database
Have my suggestions helped?
Best regards,
Zhi-Qiang Ni
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
Answer” if a marked post does not actually answer your question.
![]() |
0 |
![]() |
hey thanks but not is my solution, please help my, please
i need for example in the proyect http://www.asp.net/learn/ajax-videos/video-278.aspx put one input button and using java script said car = acure , Model = integra, color = blue ,,,, i supose this
<script language="javascript" type="text/javascript">
<!--
function Button1_onclick() {
document.getElementById('ddlMakes').value=1;
document.getElementById('ddlModels').value=2;
document.getElementById('ddlColors').value=3;
}
// -->
</script>but not working
Juan Carlos Castillo
![]() |
0 |
![]() |
go and see this code u will get the answer
http://forums.asp.net/t/1348373.aspx
![]() |
0 |
![]() |
hey,,,,, i research for many page of internet and this is not posibilite
thanks the only solution was using the update panel, and put this information the side server, and not using cascading dropdownlist
i am very sad,,
Juan Carlos Castillo
![]() |
0 |
![]() |