Julio Pz

Julio Pz

  • NA
  • 23
  • 1k

How to make a video slide and images with asp.net?

Sep 5 2016 3:35 PM
I need to make a slide video and images with asp.net, SlideExtender only works with pictures, the only option left is to make conditional updatepanel with a timer but I ran out of ideas, please some other ideas:
 
HTML Code:
 
  1. <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>  
  2.         <div>  
  3.             <asp:Timer ID="SlideShowTimer" runat="server" Interval="5000" OnTick="SlideShowTimer_Tick"></asp:Timer>  
  4.             <asp:UpdatePanel ID="SlideShowUpdPnl" runat="server" UpdateMode="Always">  
  5.                 <ContentTemplate>  
  6.                     <div id="DivSlide">  
  7.                         <img id="SlideShowImage1" src="images/logo11.png" runat="server" alt="Sanmina-SCI" visible="true" />  
  8.                           <video runat="server" id="SlideShoVideo" src="Uploads/Avideo1.mp4" controls="controls" autoplay="autoplay" visible="true"/>  
  9.                         <asp:Label ID="LblTitleSlideShow" runat="server" Text=""></asp:Label>  
  10.                     </div>  
  11.                 </ContentTemplate>  
  12.                 <Triggers>  
  13.                     <asp:AsyncPostBackTrigger ControlID="SlideShowTimer" EventName="Tick" />  
  14.                 </Triggers>  
  15.             </asp:UpdatePanel>  
  16.         </div>  
Code Behind: 
  1. protected void SlideShowTimer_Tick(object sender, EventArgs e)  
  2.         {  
  3.             DateTime later = DateTime.Now.AddSeconds(.5);  
  4.             while (DateTime.Now < later)  
  5.             {  
  6.                 LblTitleSlideShow.Text = "Time Later : " + later;  
  7.             }  
  8.             this.SlideShowImage1.Src = RandomImageName();  
  9.             this.LblTitleSlideShow.Text += this.SlideShowImage1.Src.ToString();  
  10.             
  11.         }  
  12.   
  13.   
  14.  private string RandomImageName()  
  15.         {  
  16.             Random rand = new Random();  
  17.             int RandomInt = rand.Next(0, 5);  
  18.             string url = null;  
  19.             switch (RandomInt)  
  20.             {  
  21.                 case 0:  
  22.                     url = "../Uploads/Jellyfish.jpg";  
  23.                     break;  
  24.                 case 1:  
  25.                     url = "../Uploads/Lighthouse.jpg";  
  26.                     break;  
  27.                 case 2:  
  28.                     url = "../Uploads/sanmina-logo.png";  
  29.                     break;  
  30.                 case 3:  
  31.                     url = "../Uploads/Tulips.jpg";  
  32.                     break;  
  33.                 case 4:  
  34.                     url = "../Uploads/Koala.jpg";  
  35.                     break;  
  36.                 case 5:  
  37.                     url = "../Uploads/Penguins.jpg";  
  38.                     break;  
  39.                 default:  
  40.                     url = "../Uploads/123.png";  
  41.                     break;  
  42.             }  
  43.             return url;  
  44.         }  
 

Answers (1)