Hi, I'm using the bootstrap carousel in asp, which contains several repeaters. Which in turn launch events. The problem I have is that when going to the server when launching an event, the slide is being changed to the first one that was generated.
I leave the example and what I have tried:
<div class="carousel slide media-carousel" id="media">
<div class="carousel-inner">
<asp:Repeater ID="rptGruposEntradas" OnItemDataBound="rptGruposEntradas_ItemDataBound" runat="server">
<ItemTemplate>
<div id="divSlide" class="item <%#If(Container.ItemIndex = hdSliderSelect.Value, "active", "") %>">
<div class="col-md-12">
<div class="ticket type-ticket-uno">
<asp:Label ID="lnkGrupoInternet" CssClass="tituloGrupoInternet clic-active"
runat="server"></asp:Label>
<asp:HiddenField ID="hdGrupoInternet" runat="server" />
<asp:HiddenField ID="hdSliderPosition" runat="server" />
I have tried to modify the hidden I use to control the initial slide when loading the page, but it has not worked
<%#If(Container.ItemIndex = hdSliderSelect.Value, "active", "") %>"
Protected Sub btnMas_Click(sender As Object, e As EventArgs)
Dim boton As Control = sender
Dim hdSliderPosition As HiddenField = boton.Parent.Parent.Parent.FindControl("hdSliderPosition")
txtCantidad.Text = txtCantidad.Text + 1
hdSliderSelect.Value = hdSliderPosition.Value
CargarFocoGrupoEntrada(sender)
End Sub
I have also tried to manually search the current slide and put the class="active"
, but I have not been able to solve it either.
Private Sub CargarFocoGrupoEntrada(control As Object)
'Obtenemos el RepeaterItem padre, el RepeaterItem del grupo y el repeater de recintos
Dim itemEntrada As RepeaterItem = BuscarRepeaterItemPadre(control)
Dim itemGrupoEntrada As RepeaterItem = BuscarRepeaterItemPadre(itemEntrada)
Dim hdGrupoInternetActual As HiddenField = BuscarHiddenHijo(itemGrupoEntrada, "hdGrupoInternet")
'Recorremos los recintos
For Each itemGrupo As RepeaterItem In rptGruposEntradas.Items
Dim hdGrupoInternet As HiddenField = BuscarHiddenHijo(itemGrupo, "hdGrupoInternet")
Dim divSlide As HtmlControl = BuscarHtmlGenericHijo(itemGrupo, "divSlide")
If hdGrupoInternet.Value.Equals(hdGrupoInternetActual.Value) Then
divSlide.Attributes()("class") = "active"
Else
divSlide.Attributes()("class") = ""
End If
Next
End Sub