Add image slideshow to your website using asp net ajax and c# Part 134

preview_player
Показать описание
Text version of the video

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.

Slides

All ASP .NET Text Articles

All ASP .NET Slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

In this video, we will discuss adding image slideshow to a website or web application.

Step 2: In the solution explorer, right click on the project name, and add "Images" folder.

Step 3: For this demo, we will use the sample pictures that are shipped with Microsoft operating system. Copy the images that are present at the following path, and paste them into the images folder.
C:\Users\Public\Pictures\Sample Pictures

Step 5: Drag and drop "UpdatePanel" control. This control, allow us to perform partial page postbacks as opposed to a full page postback. The responsiveness of a page can be significantly increased using partial page postback, as only the data that is relevant to that UpdatePanel is sent to the server, and only the corresponding data is returned. Another benefit of partial page postbacks is that, they avoid screen flickers that are very common with full page postbacks.

All the content of the updatepanel, must be placed inside ContentTemplate element, so include ContentTemplate tag directly inside updatepanel. Drag and drop, the timer and image controls onto the webform, so that they are placed inside the ContentTemplate tag.
1. The Timer control raises a tick event. This event is raised when the specified timer interval has elapsed and the timer is enabled.
2. Timer interval is specified in milli-seconds. For example, If you want the tick event to be raised every one second, then set "Interval" property of timer control to "1000" milliseconds.
3. We will use the tick event of the timer control to change the image dynamically every one second. So, flip the webform to design mode, if it's not already in design mode. Double click on the timer control. This should generate an event handler for tick event.
4. Set the Image control height and width to 100px.
5. Finally copy and paste the following code in the code-behind file.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SetImageUrl();
}
}

private void SetImageUrl()
{
// Create an instance of Random class
Random _rand = new Random();
// Generate a random number between 1 and 8
int i = _rand.Next(1, 8);
// Set ImageUrl using the generated random number
Image1.ImageUrl = "~/Images/" + i.ToString() + ".jpg";
}

// This event is raised every one second as we have set
// the interval to 1000 milliseconds
protected void Timer1_Tick(object sender, EventArgs e)
{
SetImageUrl();
}

Рекомендации по теме
Комментарии
Автор

Hats off to you Venkat, you don't believe how your videos are helping me and others worldwide....
Zaheer Shaikh
New Jersey

zaheershaikh
Автор

Simple and Powerful explanation . So Nice to watch this video. And it is perfectly working for me. Thank you so much :)

chrisvino
Автор

Your expression is amazing..explained very very well.thnk u soo soo much

ifElseFor
Автор

Realy great, I like your way of presentation. I am seeing all your viedos.

HarshivFun
Автор

Thank you very much for taking time to give feedback. In the description of this video, I have included the link for ASP .NET, C#, and SQL Server playlists. All the videos are arranged in logical sequence in these playlists, which could be useful to you. Please share the link with your friends who you think would also benefit from them. If you like these videos, please click on the THUMBS UP button below the video. For email alerts, when new videos are uploaded, you may subscribe to my channel.

Csharp-video-tutorialsBlogspot
Автор

your videos are so thanx a lottt.... God Bless u... !!!

supriyasrivastava
Автор

Thank u thank u thank u sooo much.. So informative.. My project is unique now.. Very well and patiently explained.. Well done.. I hope to learn more from ur other videos.. Thanks again..

nidhidhu
Автор

Great tutorial. This does exactly what I need. THUMBS UP!!!!

Rifat
Автор

was clear and upto my expectation..thnkz a lot..

varshasuresh
Автор

Hello kudvenkat thank you for this interesting video about image presentation, It helped me a lot!
I recreated the program and it works fine.
Now I have a question:
when i use a animated Gif picture of say two frames first frame 50 milliseconds and second frame 20 milliseconds an put it in the image folder
then only the first time this animated gif is shown you can see it, the second time its a blank picture. All the other pictures (jpg) are shown again.
Is there a way to overcome this or to reset the animated Gif?
thank you

jansterenborg
Автор

very good explanation, as expected, thank you

vanziganan
Автор

I am very much impressed the way you clearly explain each and everything. Thanx a ton for it. I am  having a JQUERY slideshow on my website. Bt the client wants a CMS so that he should be able to upload his own images in future. Any help in this regards????

VasalathAliSameer
Автор

Great Tutorial....sir plz you upload videos from Basic of AJAX...Its working n all so it will better for us...but sir ur god for

umeshhande
Автор

Very useful video, Thank you so much.

virithajonnala
Автор

This has helped  me a lot. Thank you so much!!!

HuzairBahadur
Автор

what i want say
your amazing
your delivery information easy and fast
and iam have question iam what best C# OR vb.net

mohnd
Автор

Thank you so much.
Great Polite teaching style <3 :*

sohaibjalil
Автор

Thank you very much! Right to the point.

PEDROMANOELS
Автор

That was a fantastic tutorial and very clear. Very useful for a beginner like me.

I had a query.

While creating a instance for Random class I am facing a error which shows that Random is type and cannot be used as a expression. What to do in this case?

nrsh
Автор

Very Thank YOu, muito obrigado por ajudar, e por favor não pare. Saudações do Brasil!!!

rat
join shbcf.ru