Provide capability to start and stop image slideshow Part 136

  • دعنا نشارك هذا :
ترتيب الدرس : 136
المدة : 00:06:29
التحكم :
Text version of the video
http://csharp-video-tutorials.blogspot.com/2013/07/part-136-provide-capability-to-start.html

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-136-provide-capability-to-start.html

All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html

ASP.NET Playlist
https://www.youtube.com/playlist?listPL4cyC4G0M1RQcB4IYS_zwkyBwMyx5AnDM

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

Please watch Parts 134 & 135 before proceeding. We will be continuing with the example, that we started in Part 135. At the moment, there is no mechanism in place to start or stop the slideshow.

What we want to achieve in this video?
1. Provide a button control as shown in the image
2. If the Sildeshow has not already started, the text on the button will be "Start Slideshow"
3. Once the button is clicked, the "slideshow" starts, and then, the text on the button will be changed to "Stop Slideshow". The images should be displayed in sequence from 1 to 8. The images should be changed dynamically in sequence until "Stop Slideshow" button is clicked.
4. Once "Stop SlideShow" button is clicked, the slideshow should stop. If the user clicks "start slideshow", then the slide show sould resume from where it was left.

To achieve this
1. Drag and drop a button control on the webform.
2. Set Text "Stop Slideshow".
3. Generate click event handler from Button1. Copy and paste the following code.
protected void Button1_Click(object sender, EventArgs e)
{
// If timer is enabled, disable timer and change
// the text on the button control accordingly
if (Timer1.Enabled)
{
Timer1.Enabledfalse;
Button1.Text"Start Slideshow";
}
// If timer is disabled, enable timer and change
// the text on the button control accordingly
else
{
Timer1.Enabledtrue;
Button1.Text"Stop Slideshow";
}
}

At the moment, there are 2 problems with this code. If we want to add a new image to the slide show,
1. We will have to modify the application code
2. The new image has to be named in a specific way. Since we already have 8 images, the next image has to be named 9.jpg.

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:26
youtube