Control repeater
Publicado por Javier (9 intervenciones) el 07/05/2007 09:22:55
Hola a todos,
Estoy programando una aplicacion con asp.net y tengo un problema con el control repeater. Para implementar unas pestanyas que dependiendo del rol del usuario se mostrarán unas u otras, he empleado un repeater para crearlas de esta forma:
documento html:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Pestanyas.ascx.vb" Inherits="eSugerencias.INTERFACES.CONTROLES_USUARIO.Pestanyas" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<link href="../ESTILOS/styleSuger.css" type="text/css" rel="StyleSheet">
<ul id="pestanyasnaveg">
<asp:Repeater id="Pestanyas" runat="server">
<ItemTemplate>
<li id="current">
<asp:LinkButton runat="server" id="Linkbutton1">
<%#Container.DataItem%>
</asp:LinkButton>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
documento ascx (es un control de usuario):
Dim ListadoPestanyas As ArrayList = New ArrayList()
Protected Pestanyas As System.Web.UI.WebControls.Repeater
Dim miusuario As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
miusuario = "Sugerente"
MostrarPestanyas()
If Not IsPostBack Then
Pestanyas.DataBind()
End If
End Sub
Public Sub MostrarPestanyas()
If (miusuario = "Sugerente") Then
Me.ListadoPestanyas.Add(Idiomas.Literal("Sugerente"))
Pestanyas.DataSource = ListadoPestanyas
ElseIf (miusuario = "Investigador") Then
Me.ListadoPestanyas.Add(Idiomas.Literal("Sugerente"))
Me.ListadoPestanyas.Add(Idiomas.Literal("Investigador"))
Pestanyas.DataSource = ListadoPestanyas
ElseIf ...
Lo que quiero hacer es que cuando se presione sobre una de esas pestanyas (que son linkbutton segun lo he definido en el repeater) el estilo de la pestanya cambie por ejemplo a otro color, pero no se hacerlo y tampoco se sacar cual es la pestanya que he seleccionado.
No se si me he explicado bien, pero necesito ayuda urgente. Que alguien me diga algo si tiene algo de idea.
Muchas gracias a todos.
Saludo.
Javi.
Estoy programando una aplicacion con asp.net y tengo un problema con el control repeater. Para implementar unas pestanyas que dependiendo del rol del usuario se mostrarán unas u otras, he empleado un repeater para crearlas de esta forma:
documento html:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Pestanyas.ascx.vb" Inherits="eSugerencias.INTERFACES.CONTROLES_USUARIO.Pestanyas" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<link href="../ESTILOS/styleSuger.css" type="text/css" rel="StyleSheet">
<ul id="pestanyasnaveg">
<asp:Repeater id="Pestanyas" runat="server">
<ItemTemplate>
<li id="current">
<asp:LinkButton runat="server" id="Linkbutton1">
<%#Container.DataItem%>
</asp:LinkButton>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
documento ascx (es un control de usuario):
Dim ListadoPestanyas As ArrayList = New ArrayList()
Protected Pestanyas As System.Web.UI.WebControls.Repeater
Dim miusuario As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
miusuario = "Sugerente"
MostrarPestanyas()
If Not IsPostBack Then
Pestanyas.DataBind()
End If
End Sub
Public Sub MostrarPestanyas()
If (miusuario = "Sugerente") Then
Me.ListadoPestanyas.Add(Idiomas.Literal("Sugerente"))
Pestanyas.DataSource = ListadoPestanyas
ElseIf (miusuario = "Investigador") Then
Me.ListadoPestanyas.Add(Idiomas.Literal("Sugerente"))
Me.ListadoPestanyas.Add(Idiomas.Literal("Investigador"))
Pestanyas.DataSource = ListadoPestanyas
ElseIf ...
Lo que quiero hacer es que cuando se presione sobre una de esas pestanyas (que son linkbutton segun lo he definido en el repeater) el estilo de la pestanya cambie por ejemplo a otro color, pero no se hacerlo y tampoco se sacar cual es la pestanya que he seleccionado.
No se si me he explicado bien, pero necesito ayuda urgente. Que alguien me diga algo si tiene algo de idea.
Muchas gracias a todos.
Saludo.
Javi.
Valora esta pregunta


0