how i can load two dropdownlist for database CascadingDropDown client-side

Last post 07-14-2009 11:12 AM by jccastillo. 3 replies.

Sort Posts:

  • how i can load two dropdownlist for database CascadingDropDown client-side

    11-05-2008, 6:07 PM
    • Member
      33 point Member
    • jccastillo
    • Member since 06-25-2008, 10:05 AM
    • Colombia
    • Posts 36

     hello my problem is the follow i save in the database 2 values that two dropdonlist with cascading and is very goog, the problem is when i search this information for my database because one dropdownlist dependet the other, because i load the first ddlist and select the values, and if select the seconf ddlist is not load, how i can load the second ddlist for client side, for java

    this is the html 

     function OnCompleteBusqueda(args)
    {       args=args;  
        var vars = args.vars;

    document.getElementById("ctl00_ContentPlaceHolder1_cboDepartamentoAfilia").value =vars[6]; //is ok

    ret = WebS.GetCiudad_Dep("Departamento","Ciudad");//how i can load the next dropdlist for select the value for client side

    fodocument.getElementById("ctl00_ContentPlaceHolder1_cboCiudadAfilia").value=vars[7];//for select this dropdowlist i need load with the information

    }

    please help my i need examples, this is the code with i load for the firstime  
    <td>state <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>

    City
    <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>
    this is the webservice webs tha i use for load the second dropdonlist  
        <WebMethod()> _
    Public Function GetCiudad_Dep2(ByVal Dep As String) As CascadingDropDownNameValue()
    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=" + Dep, 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 Function
     
     
     
     
      
    Juan Carlos Castillo
  • Re: how i can load two dropdownlist for database CascadingDropDown client-side

    02-06-2009, 8:39 AM
    • All-Star
      15,229 point All-Star
    • yasserzaid
    • Member since 09-22-2007, 9:10 PM
    • Egypt
    • Posts 2,579
    Yasser Zaid
    My Blog [http://yasserzaid.wordpress.com/]
  • Re: how i can load two dropdownlist for database CascadingDropDown client-side

    02-06-2009, 8:48 AM
    • All-Star
      15,229 point All-Star
    • yasserzaid
    • Member since 09-22-2007, 9:10 PM
    • Egypt
    • Posts 2,579
    Yasser Zaid
    My Blog [http://yasserzaid.wordpress.com/]
  • Re: how i can load two dropdownlist for database CascadingDropDown client-side

    07-14-2009, 11:12 AM
    Answer
    • Member
      33 point Member
    • jccastillo
    • Member since 06-25-2008, 10:05 AM
    • Colombia
    • Posts 36

    this is the solution in the client side, but you can load the values from database using a web service , but this is the principal idea

    function Button1_onclick() {
    var dd = $find("cddMakes");
       dd.set_SelectedValue('2');
    dd._onParentChange(null, true);
    $find('cddModels').set_SelectedValue('6');   
    $find('cddModels')._onParentChange(null, true);
     $find('cddColors').set_SelectedValue('15');   
    $find('cddColors')._onParentChange(null, true);
    }

        </script>

     jejej the solution

    Juan Carlos Castillo
Page 1 of 1 (4 items)
Microsoft Communities