TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
rinku kansara
NA
5
5k
gallary slide show in asp.net
Jun 8 2013 2:00 AM
I am using c#.net 3.5 framework for developing web application.
i want to use gallary slide show without data base.
i have a code for slide show but using that code, image slide change once.
after that it will no change in slide. if any problem in code pls suggest me true code.
gallaryHome.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GallaryHome.aspx.cs" Inherits="GallaryHome" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:Timer runat="server" Interval="1000" ID="SlideShowTimer" OnTick="SlideShowTimer_Tick" />
<br />
<h2 style="text-transform: uppercase; margin: 10px 0px 0px 8px; display: inline;">
Welcome to My Photo Gallery
</h2>
<br />
<asp:UpdatePanel runat="server" ID="SlideShow" UpdateMode="Always">
<ContentTemplate>
<%-- This is the main slideshow image control --%>
<img runat="server" id="SlideShowImage1" src="~/Image/jaiminilogin.png" alt="First Image" />
<asp:Label runat="server" ID="SlideShowText" Text="First Slide" />
</ContentTemplate>
<Triggers>
<%-- The update panel will postback when the timer 'tick' event fires --%>
<asp:AsyncPostBackTrigger ControlID="SlideShowTimer" EventName="Tick" />
</Triggers>
</asp:UpdatePanel>
<cc1:UpdatePanelAnimationExtender runat="server" ID="UPextender" TargetControlID="SlideShow"
BehaviorID="animation">
<Animations>
<OnUpdating>
<%-- It should take 1/2 of a second to fade out --%>
<FadeOut Duration=".2" Fps="20" minimumOpacity=".1" />
</OnUpdating>
<OnUpdated>
<%-- It should take 1 and 1/2 of a second to fade back in --%>
<FadeIn Duration="1.5" Fps="20" minimumOpacity=".1" />
</OnUpdated>
</Animations>
</cc1:UpdatePanelAnimationExtender>
</div>
</div>
</form>
</body>
</html>
gallaryHome.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class GallaryHome : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SlideShowTimer_Tick(object sender, EventArgs e)
{
DateTime later = DateTime.Now.AddSeconds(.5);
while (DateTime.Now < later)
{
}
this.SlideShowImage1.Src = RandomImageName();
this.SlideShowText.Text = this.SlideShowImage1.Src.ToString();
}
private string RandomImageName()
{
Random rand = new Random();
int RandomInt = rand.Next(0, 5);
switch (RandomInt)
{
case 0:
return "~/Image/admin.jpg";
break;
case 1:
return "~/Image/jaiminilogin.png";
break;
case 2:
return "~/Image/papeless1.jpg";
break;
default:
return "~/Image/paperlesslogo.jpg";
break;
}
}
}
pls help me
Reply
Answers (
0
)
C sharp commandline
How to sort inside gridview