Dynamic Image Gallery ASP.Net C #

2

I have the following code,  It loads the photos in that placeholder. ID="phPhotos" >

 public partial class ImovelDetalhe : System.Web.UI.Page
    {
        private ImovelBo _imovelBo;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                carregarInformacoes();
            }
        }

        private void carregarInformacoes()
        {
            int codigoImovel = 0;
            Int32.TryParse(Request.QueryString["CodImovel"], out codigoImovel);

            _imovelBo = new ImovelBo();
            var imovel = _imovelBo.ObterDetalhe(codigoImovel);

            if (imovel != null)
            {
                lblDescricao.Text = imovel.Descricao;
                lblOperacao.Text = imovel.Operacao;
                lblCidade.Text = imovel.Cidade;
                lblLocalizacao.Text = imovel.Localizacao;
                lblTipoImovel.Text = imovel.Tipo;
                lblQtDormitorios.Text = imovel.QntDormitorio.ToString();
                lblValor.Text = imovel.Valor.ToString("#,##0.00");

                if (imovel.Fotos != null)
                {
                    foreach (var item in imovel.Fotos)
                    {
                        Image foto = new Image();
                        foto.Width = 500;
                        foto.Height = 400;
                        foto.ImageUrl = item;
                        phFotos.Controls.Add(foto);
                    }
                }
            }
        }      
    }

And when I run the images it looks like this: one below the other

Could someone help us make a car, slide show or a banner? as per this example or simpler:

I could not get past the path of the photos that are in the bank and at the root

    
asked by anonymous 17.08.2016 / 21:21

1 answer

1

Get this list you have with the photos (real estate.Photos), assign it to an ASP.NET Repeater control and the $ ('# mycarousel') javascript. jcarousel (); will take care of displaying correctly.

 <script type="text/javascript">
   $(function () {
      $('#mycarousel').jcarousel();
   });
 </script>
<ul id="mycarousel" class="jcarousel-skin-tango">
<asp:Repeater ID="rptImages" runat="server">
    <ItemTemplate>
        <li>
            <img alt="" style='height: 75px; width: 75px' src='<%# Eval("ImageUrl") %>' />
        </li>
    </ItemTemplate>
</asp:Repeater>

By putting the ul mycarousel id and turning it into a jcarousel, any li tag with the correct src property will be displayed on your slider.

The JS lib is the one here: link

    
09.11.2016 / 12:48