locked
How to group images in gallery RRS feed

  • Question

  • User595323411 posted

    Hi, I have to tables
    Gallery --->id_gallery
                     id_villa
                    NameOfGallery

    Pictures ---->id_pic
                       id_gallery
                       Picture

    Stored Procedure:

    PROCEDURE Galleries
    @id_vila int
    AS
    select Gallery.id_Gallery, Gallery.id_villa, Gallery.NameOfGallery, Pictures.id_Gallery, Pictures.Picture
    from Gallery
    inner join Pictures
    on Gallery.id_Gallery = Pictures.id_Gallery
    where
    Gallery.id_villa = @id_villa

    Two nested Repeaters
    <asp:Repeater ID="some" runat="server" DataSourceID="dsssss">
    <ItemTemplate>
    <h2><%# Eval("NaslovNaGalerija") %></h2>
    <br />
    <asp:Repeater ID="ghjga" runat="server" DataSourceID="dsssss">
    <ItemTemplate>
    <div class="col-lg-3 col-md-6 col-sm-6 col-xs-12 image">
    <div class="img-wrapper">
    <a href="img/<%#Eval("Picture") %>"><img src="img/<%#Eval("Picture") %>" class="img-responsive"></a>
    <div class="img-overlay">
    <i class="fa fa-plus-circle" aria-hidden="true"></i>
    </div>
    </div>
    </div>
    </ItemTemplate>
    </asp:Repeater>
    </ItemTemplate>
    </asp:Repeater>

    I'd like to show images using querystring like when request querystring idvilla=3 to show gallery like this one:

    Name of gallery
    pic1  pic 2  pic3
    pic 4 pic5  pic6

    Name of gallery2
    pic6  pic7  pic 8

    Name of gallery3
    pic9  pic10  pic 11

    Tuesday, March 3, 2020 6:17 PM

All replies

  • User288213138 posted

    Hi MiDKompjuteri,

    Name of gallery
    pic1  pic 2  pic3
    pic 4 pic5  pic6

    Name of gallery2
    pic6  pic7  pic 8

    Name of gallery3
    pic9  pic10  pic 11

    According to your description, I couldn’t understand your requirement clearly.

    Can you elaborate on the relationship between gallery, gallery2, and gallery3?

    Best regards,

    Sam

    Wednesday, March 4, 2020 7:21 AM
  • User595323411 posted

    I need to create 3 galleries for one villa apartment

    Ex:
    Villa with name Arista has studio, apartment, room and I'd like to create galleries

    Villa Arista Studio
    pic1 pic2 pic3

    Villa Arista Apartment
    pic1 pic2 pic3

    Villa Arista Room
    pic1 pic2 pic3

    So when I call with querystring idvilla=3 description of Villa Arista, I need to get these 3 galleries as I show above

    Wednesday, March 4, 2020 8:33 AM
  • User288213138 posted

    Hi MiDKompjuteri,

    I need to create 3 galleries for one villa apartment

    Ex:
    Villa with name Arista has studio, apartment, room and I'd like to create galleries

    Villa Arista Studio
    pic1 pic2 pic3

    Villa Arista Apartment
    pic1 pic2 pic3

    Villa Arista Room
    pic1 pic2 pic3

    So when I call with querystring idvilla=3 description of Villa Arista, I need to get these 3 galleries as I show above

    Sorry, I still can't understand your question, in your aspx page, The "NaslovNaGalerija" field is not found in your database.

    Can you post your complete code and information?

    If you want to Implement Nested Repeater you can refer to this link: https://www.aspsnippets.com/Articles/Implement-Nested-Repeater-Repeater-inside-Repeater-with-example-in-ASPNet-using-C-and-VBNet.aspx

    Best regards,

    Sam

    Wednesday, March 4, 2020 9:31 AM
  • User595323411 posted

    Hi MiDKompjuteri,

    Sorry, I still can't understand your question, in your aspx page, The "NaslovNaGalerija" field is not found in your database.

    "NaslovNaGalerija"field NameOfGallery

    Wednesday, March 4, 2020 9:47 AM
  • User288213138 posted

    Hi MiDKompjuteri,

    Villa Arista Studio
    pic1 pic2 pic3

    Villa Arista Apartment
    pic1 pic2 pic3

    Villa Arista Room
    pic1 pic2 pic3

    If you want the repeater to display like this, you only need to bind three pieces of data to each of them.

    You can use ado.net if you want to call a stored procedure. here a demo for you as a reference.

    string constring = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
                    using (SqlConnection con = new SqlConnection(constring))
                    {
                        using (SqlCommand cmd = new SqlCommand("your stored procedure", con))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            con.Open();
                            IDataReader idr = cmd.ExecuteReader();
                            some.DataSource = idr;
                            some.DataBind();
                        }
                    }
    

    Best regards,

    Sam

    Thursday, March 5, 2020 5:33 AM