Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/09/2013, 10:46
Avatar de ASDRUBAL2112
ASDRUBAL2112
 
Fecha de Ingreso: septiembre-2013
Mensajes: 12
Antigüedad: 10 años, 7 meses
Puntos: 0
Pregunta Cómo poblar un Dropdownlist dentro de Repeater, utilizando CommandArgumnet

Hola, la presente es para pedirles ayuda sobre un temita que me tiene un poquillo tensionado, el asunto es el siguiente:
  1. Tengo una Dropdownlist que se llama "ddlHorario" que está dentro de un repeater que se llama "drepeaterPersonas", este repeater muestra personas.
  1. Tengo una una consulta que genera varios campos, y existe un campo que se llama "CargarHorario", estoy tratando de capturar ese campo dentro del dropdownlist por medio de: CommandArgument='<%#Eval("CargarHorario")%>', pero no he podido.
  1. El poblado del dropdownlist y la carga del repeater es generado a raiz de un botón, hago click en un botón "Generar" y deberá poblar el dropdownlist para cada persona y también el repeater.

Alguien me podría ayudar a poder resolver este temita, se lo agradecería.

PD. Les dejo el código del diseño y de la clase, respectivamente.

CODIGO DEL DISEÑO
=================

<asp:Repeater runat="server" ID="rptMedicos">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<div class="HorarioWidth">
<div>
<table class="AnchoTabla">
<tr>
<td rowspan="4" style="vertical-align:top;text-align:left;width:110px;height:129px">
<div class="DivImgCita">
<asp:Image runat="server" ID="imgDoc" AlternateText="Doctor" CssClass="Doctor" ImageUrl='<%#Eval("vimgmedico")%>' />
<%--<img src="<%#Eval("vimgmedico","~/Doctores/{0}")%>" alt="Doctor" class="Doctor" />--%>
<!-- <img src="Doctores/.jpg" alt="Doctor" class="Doctor" />-->
</div>
</td>
<td colspan="2">
<div class="titNomDoc">
<%#UCase(Eval("NombreCom"))%>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="titDetDoc">
<%#Eval("Horario")%>
</div>
</td>
</tr>
<tr>
<td style="width:100px;color:#666666">
Horario ::</td>
<td>
<div>
<asp:dropdownlist ID="ddlHorario" runat="server"
CommandName="CargarComboHorario"
CommandArgument='<%#Eval("CargarHorario")%>'>
</asp:dropdownlist>

</div>
<%--<div class="titDetDoc">
CommandArgument='<%#DataBinder.Eval("CargarHorario ")%>'
</div>--%>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;</td>
</tr>
</table>

</div>
</div>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>


CODIGO DE LA CLASE
================


Protected Sub rptPersonas_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptPersonas.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
Dim x As Image = CType(e.Item.FindControl("imgDoc"), Image)

Dim ddList As DropDownList = DirectCast(e.Item.FindControl("ddlHorario"), DropDownList)


If Not System.IO.File.Exists(MapPath(x.ImageUrl)) Then
x.ImageUrl = "~/Doctores/DoctorH.png"
Else
x.ImageUrl = x.ImageUrl & "?n=" + DateTime.Now.Second.ToString()
End If
End If
End Sub



Protected Sub rptPersonas_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs ) Handles rptPersonas.ItemCommand
If (e.CommandName = "CargarComboHorario") Then
'Do your work

End If
End Sub

Última edición por ASDRUBAL2112; 27/09/2013 a las 10:54