<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
>
	<channel>
		<title>Dudas de Programacion &#187; Topic: Necesito Ayuda con DropDownList en aspx</title>
		<link>http://www.dudasprogramacion.com/topic/necesito-ayuda-con-dropdownlist-en-aspx</link>
		<description>Dudas sobre lenguajes y apis de programación</description>
		<language>en-US</language>
		<pubDate>Wed, 08 Feb 2012 21:07:44 +0000</pubDate>
		<generator>bbpress 1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.dudasprogramacion.com/search.php</link>
		</textInput>
		<atom:link href="http://www.dudasprogramacion.com/rss/topic/necesito-ayuda-con-dropdownlist-en-aspx" rel="self" type="application/rss+xml" />

		<item>
			<title>meline on "Necesito Ayuda con DropDownList en aspx"</title>
			<link>http://www.dudasprogramacion.com/topic/necesito-ayuda-con-dropdownlist-en-aspx#post-460</link>
			<pubDate>Fri, 28 May 2010 01:41:54 +0000</pubDate>
			<dc:creator>meline</dc:creator>
			<guid isPermaLink="false">460@http://www.dudasprogramacion.com/</guid>
			<description><p>Tendo un dropdownlist k me muestra nombres de departamentos de trabajo.<br />
y necesito k al momento de seleccionar un departamento en otro dropdownlist me muestra el nombre de los empleados que hay solo en ese departamento seleccionado aqui le pongo parte del codigo que estoy realizando, espero que puedan ayudarme. de ante mano gracias<br />
 ESTE ES EL QUE MUESTRA EL NOM DE LOS DEPARTAMENTOS EN ASP:<br />
 &#60;asp:SqlDataSource ID=&#34;dsSql2&#34; runat=&#34;server&#34; ConnectionString=&#34;&#60;%$ ConnectionStrings:RHABCD %&#62;&#34;<br />
                                SelectCommand=&#34;Select * from tblCentros&#34;&#62;&#60;/asp:SqlDataSource&#62;<br />
                            &#60;asp:DropDownList ID=&#34;cbnomdepto&#34; runat=&#34;server&#34; class=&#34;cajas_text4&#34; DataSourceID=&#34;dsSql2&#34;<br />
                                DataTextField=&#34;Nomdepto&#34; DataValueField=&#34;Centro&#34;<br />
                                OnSelectedIndexChanged=&#34;ActualizarDeptos&#34; AutoPostBack=&#34;true&#34; Height=&#34;16px&#34; Width=&#34;273px&#34;&#62;<br />
                            &#60;/asp:DropDownList&#62;</p>
<p>Y EN VISUAL BASIC ESTO ES LO K ESTOY HACIENDO PARA QUE AL SELECCIONAR EL DEPARTMENTO ME MUESTRE EL NOMBRE DE LOS EMPLEADOS:<br />
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load</p>
<p>        If Not Page.IsPostBack Then<br />
            cbDesemp.Items.Add(&#34;Excelente&#34;)<br />
            cbDesemp.Items.Add(&#34;Muy buena&#34;)<br />
            cbDesemp.Items.Add(&#34;Buena&#34;)<br />
            cbDesemp.Items.Add(&#34;Regular&#34;)<br />
            cbDesemp.Items.Add(&#34;Mala&#34;)<br />
            cbDesemp.Items.Add(&#34;Pésima&#34;)<br />
// aqui estoy utilizando una tabla en memoria:<br />
            Dim tbxPercepciones As New DataTable<br />
            tbxPercepciones.Columns.Add(&#34;idPercepcion&#34;, GetType(Int16))<br />
            tbxPercepciones.Columns.Add(&#34;Percepcion&#34;, GetType(String))<br />
            tbxPercepciones.Columns.Add(&#34;Rfc&#34;, GetType(String))</p>
<p>            'tbxEmpleados As New DataTable<br />
            tbxEmpleados.Columns.Add(&#34;Rfc&#34;, GetType(String))<br />
            tbxEmpleados.Columns.Add(&#34;Nombre&#34;, GetType(String))</p>
<p>            Dim myConnection As SqlConnection<br />
            Dim myCommand As SqlCommand<br />
            Dim dr As SqlDataReader<br />
            'declaring the objects<br />
            myConnection = New SqlConnection(&#34;server=serversql;uid=produccion;pwd=qpaso@produccion;database=rh_abcd&#34;)<br />
            Try<br />
                myConnection.Open()</p>
<p>                'opening the connection<br />
                myCommand = New SqlCommand(&#34;Select * from tblEvaluacionP&#34;, myConnection)<br />
                'executing the command and assigning it to connection<br />
                dr = myCommand.ExecuteReader()<br />
                While dr.Read()<br />
                    'reading from the datareader<br />
                    tbxPercepciones.Rows.Add(dr(&#34;idEvaluacionP&#34;), dr(&#34;NombreEvaluacion&#34;), vbNull)<br />
                End While<br />
                dr.Close()</p>
<p>                'opening the connection<br />
                'myCommand = New SqlCommand(&#34;Select Rfc, Nombre from Andreus where centro='050005005053'&#34;, myConnection)<br />
                myCommand = New SqlCommand(&#34;Select Rfc, Nombre from Andreus where centro='nomdepto'&#34;, myConnection)<br />
                'executing the command and assigning it to connection<br />
                dr = myCommand.ExecuteReader()</p>
<p>                tbxEmpleados.Rows.Add(vbNull, &#34;No Seleccionado&#34;)<br />
                cbnomdepto.Text = &#34;nomdepto&#34;<br />
                While dr.Read()<br />
                    'reading from the datareader<br />
                    tbxEmpleados.Rows.Add(dr(&#34;Rfc&#34;), dr(&#34;Nombre&#34;))<br />
                End While<br />
                dr.Close()</p>
<p>                myConnection.Close()<br />
            Catch<br />
            End Try</p>
<p>            gvPercepcion.DataSource = tbxPercepciones<br />
            gvPercepcion.DataBind()</p>
<p>        End If</p>
<p>    End Sub</p>
<p>    Protected Sub ActualizarDeptos(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbnomdepto.SelectedIndexChanged<br />
        Dim cbEmpleados As DropDownList<br />
        Dim myConnection As SqlConnection<br />
        Dim myCommand As SqlCommand<br />
        myConnection = New SqlConnection(&#34;server=serversql;uid=produccion;pwd=qpaso@produccion;database=rh_abcd&#34;)<br />
        Try<br />
            myConnection.Open()<br />
            Dim dr As SqlDataReader<br />
            myCommand = New SqlCommand(&#34;Select Rfc, Nombre from Andreus where nomdepto=@nomdepto&#34;, myConnection)<br />
            'executing the command and assigning it to connection<br />
            dr = myCommand.ExecuteReader()<br />
            cbnomdepto.DataValueField = &#34;nomdepto&#34;<br />
            While dr.Read()<br />
                'reading from the datareader<br />
                cbEmpleados = cbnomdepto<br />
                cbEmpleados.Items.Add(&#34; No Seleccionado&#34;)<br />
                cbEmpleados.SelectedIndex = cbEmpleados.Items.Count - 1<br />
                cbEmpleados.SelectedItem.Value = &#34;nomdepto&#34;<br />
            End While<br />
            dr.Close()</p>
<p>            myConnection.Close()<br />
        Catch<br />
        End Try</p>
<p>        cbnomdepto.DataBind()<br />
    End Sub</p>
<p>    Protected Sub gvPercepcion_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)<br />
        Dim ddl As DropDownList</p>
<p>        If (Not IsPostBack) Then<br />
            If (e.Row.RowType = DataControlRowType.DataRow) Then<br />
                ddl = e.Row.FindControl(&#34;cbEmpleados&#34;)<br />
                ddl.DataSource = tbxEmpleados<br />
                ddl.DataBind()<br />
            End If<br />
        End If<br />
    End Sub</p>
<p>que es lo k estoy haciendo mal alguien k me ayude x favor...
</p></description>
		</item>

	</channel>
</rss>

