Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/09/2010, 20:01
miguelajh
 
Fecha de Ingreso: julio-2006
Ubicación: En algún lugar de un grán pais
Mensajes: 112
Antigüedad: 17 años, 10 meses
Puntos: 2
DATALIST con TEMPLATE

Salu2.
Estoy usando Visual Studio 2005 y framework 2.0.
Actualmente tengo un DATALIST en el cuál edito el template y le pongo unas etiquetas que se llenan de a cuerdo al origen de datos.
En el template de ITEM TEMPLATE está identico y en el ALTERNATING ITEM TEMPLATE
En los 2 pongo una imagen, para que se vea mas bonito, le pongo una imagen distinta , que es una flecha azul y la otra es una flecha azul pero mas fuerte.

Lo que necesito hacer es lo siguiente:
1.- Voy a leer registro pro registro en el evento: DataList1_ItemDataBound.
2.- Voy a revisar el contenido del valor de una de las label que puse y que está así:

Código:
<asp:Label ID="SECLabel" runat="server" Text='<%# Eval("MASECU") %>' Font-Size="X-Small" Width="96px"></asp:Label><br />
3.-Posteriormente necesito verificar que el valor que tenga si es "X" entonces no hacer nada, pero si es "Y" entonces necesito cambiar del <img> la imagen que presenta y cambiarla por otra...

4.- Necesito identificar cual es el IMG, porque como ven.. tengo 2 uno para el item y otro para el alternate. ahi no se´como hacerle para sabe cual tengo que modificar por ejemplo:

Código:
<img src="~/../imgs/flechaazul02.png" style="width: 24px; height: 24px" />
como le digo.. este es el img del normal o este es el img del alternativo... y para pasarle que envez de la flecha azul, use la flecha "ROJA" ?...

Actualmente mi datalist está asi:

Código:
<asp:DataList ID="DataList1" runat="server" CellPadding="0" RepeatColumns="8" RepeatDirection="Horizontal" Font-Names="Arial" Font-Size="X-Small" BorderColor="#336666" BackColor="White" BorderStyle="Double" BorderWidth="3px" GridLines="Horizontal">
    <FooterStyle BackColor="White" ForeColor="#333333" />
    <SelectedItemStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
    <ItemTemplate>
        <table>
            <tr>
                <td style="font-size: x-small; ">
                    SEC:
                    <asp:Label ID="SECLabel" runat="server" Text='<%# Eval("MASECU") %>' Font-Size="X-Small" Width="96px"></asp:Label><br />
                    PERFIL:
                    <asp:Label ID="PERFILLabel" runat="server" Text='<%# Eval("PERFIL") %>' Font-Size="X-Small" Width="104px"></asp:Label><br />
                    LIMITE:
                    <asp:Label ID="MONFINLabel" runat="server" Text='<%# Eval("MAMFIN", "{0:###,###,###,###.00}") %>' Font-Size="X-Small" Width="104px"></asp:Label>
                </td>
                <td>
                    <img height="24" src="~/../imgs/flechaazul01.png" style="width: 24px; height: 24px" />
                    </td>
            </tr>
        </table>
    </ItemTemplate>
    <ItemStyle BackColor="White" ForeColor="#333333" />
    <AlternatingItemTemplate>
        <table>
            <tr>
                <td style="font-size: x-small">
                    SEC:
                    <asp:Label ID="SECLabel" runat="server" Text='<%# Eval("MASECU") %>'></asp:Label><br />
                    PERFIL:
                    <asp:Label ID="PERFILLabel" runat="server" Text='<%# Eval("PERFIL") %>'></asp:Label><br />
                    LIMITE:
                    <asp:Label ID="MONFINLabel" runat="server" Text='<%# Eval("MAMFIN", "{0:###,###,###,###.00}") %>'></asp:Label>
                </td>
                <td>
                    <img src="~/../imgs/flechaazul02.png" style="width: 24px; height: 24px" />
                 </td>
            </tr>
        </table>
    </AlternatingItemTemplate>
</asp:DataList>

Gracias por su apoyo de antemano.