javascript - C# ASP.NET Server Side Carousel Slider with Dynamic Number of Pages -


i working server side carousel slider , having hard time dealing manual scrolling of slider. although, automatic sliding working using data-interval="5000" data-ride="carousel" of bootstrap css , js. know how make slides work in client side scrolling. managed fetch data server slider controls <a href=""...next/> , prev doesn't work.

code:

slider.aspx

<asp:panel runat="server" id="mycarousel" class="carousel slide"             data-interval="5000" data-ride="carousel">                                 <ol class="carousel-indicators"></ol>                                 <asp:panel runat="server" id="carousel_inner" class="carousel-inner">                                                          </asp:panel>                <%--- these won't work.---%>               <a class="left carousel-control" runat="server" href="#mycarousel"                   role="button" data-slide="prev" style="text-decoration:none;"><</a>               <a class="right carousel-control" runat="server" href="#mycarousel"                   role="button" data-slide="next" style="text-decoration:none;">></a> </asp:panel> 

slider.aspx.cs

//sample data int items = 8;  //initial class static string cssclass = "active item"; protected void showslides() {     datatable dt = slidemanager.getslidesdynamically(items);     literal str = new literal();     str.visible = true;     str.text = "<br/>";     if (dt.rows.count > 0)     {         foreach (datarow dr in dt.rows)         {             panel item = new panel();             item.visible = true;             item.cssclass = cssclass;                         literal img = new literal();             img.visible = true;             img.text = "<img runat='server' " +                         "src='data:image/jpeg;base64," +                         dr[0].tostring() +                         "' class='carouselimage' />";                           item.controls.add(img);                             panel caption = new panel();             caption.visible = true;             caption.cssclass = "carousel-caption";             literal title = new literal();             title.visible = true;             title.text = "<h3 runat='server'>" + dr[2].tostring() + "</h3>";             literal capt = new literal();             capt.visible = true;             capt.text = "<p runat='server'>" + dr[3].tostring() + "</p>";             caption.controls.add(title);             caption.controls.add(capt);             item.controls.add(caption);              //invoke controls slider             carousel_inner.controls.add(item);             cssclass = "item";             }     } } 

make sure id of carousel div mycarousel. in asp ids changed. if id not same add line clientidmode=static carousel panel


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -