locked
how to load the images from database to Bootstrap carousel-inner in asp.net RRS feed

  • Question

  • User-1263702099 posted

    Hai,

    <div class="carousel-inner">
    <div class="item active">
    <img src="Themes/Pratham/images/slider/banner-1.jpg" class="img-responsive" width="100%" alt="Pratham Mysore">
    <div class="carousel-caption"><span class="cap-first">Every Child </span><br><span class="cap-second">in School & Learning Well</span></div>
    </div>

    For this code how to implement to load the images from database to Bootstrap carousel-inner

    Friday, May 27, 2016 12:27 PM

All replies

  • User-286291038 posted

    Hi,

    If you are using ASP.NET MVC, then please fill your view model with the image details such as path, alt text etc. Then you can replace the hardcoded values with these model properties.

    Friday, May 27, 2016 1:29 PM
  • User-1263702099 posted

    Hai,

     I am using asp.net 3 tier architecture.please tell me how to do .

    Saturday, May 28, 2016 4:27 AM
  • User1559292362 posted

    Hi NatarajYashash,

    I am using asp.net 3 tier architecture.please tell me how to do .

    I would suggest that you could use asp.net image control, retrieve the image URL from database and assign it to image control, like this:

    ASP.Net Page,

     <div class="carousel-inner">
         <div class="item active">
            <asp:Image ID="Image1" runat="server" class="img-responsive" alt="Pratham Mysore"/>
            <div class="carousel-caption"><span class="cap-first">Every Child </span><br/>
             <span class="cap-second">in School & Learning Well</span>
         </div>
         </div>

    Code Behind

     protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    //retrieve image URL from your database;
    
                    Image1.ImageUrl = the image URL you retrieving from your database;
                }
            }

    Best regards,

    Cole Wu

    Saturday, May 28, 2016 9:42 AM
  • User-1263702099 posted

    Hai,

     Am retrieving  moirethan one images at a time ,how to implement

    Saturday, May 28, 2016 1:04 PM
  • User1559292362 posted

    Hi NatarajYashash,

    Am retrieving  moirethan one images at a time ,how to implement

    it seems that you need to do a loop, for more information, please refer to:

    http://stackoverflow.com/questions/34562437/uploading-and-displaying-multiple-images-from-database-in-mvc

    Best regards,

    Cole Wu

    Monday, June 6, 2016 3:31 AM