Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Suppose I want to add wise quotes in my ASP.NET website and it should change each time when page is refreshed.

you can see the link from where I thought of using it.It is on left side Wise Quotes.

http://www.indiabix.com/networking/tcp-ip/003004[^]

How can I get this in my ASP.NET website.....
Posted
Updated 13-Nov-14 3:23am
v2
Comments
Mukesh Pr@sad 13-Nov-14 9:40am    
in each postback ...u can change the content of the control

1 solution

You can generate a Random number each time the web page is called, and use that number to extract the Qoute from the source (i.e. Database, Text File, or some other website).

You can assign an ID to each of the Qoute, and then generate a Random number, that would start from 0 and would span upto the maximum number of the QuoteID you're having.

C#
// Add one because it generates randoms equal to number passed - 1
Random random = new Random(maxQouteId + 1);

// use this random number to extract the random Qoute


Read more on Randoms here on MSDN[^].
 
Share this answer
 
Comments
Member 11132163 13-Nov-14 11:35am    
As I am new to this can you tell me by adding one quote how to do if I store the Quotes in the text file...
Afzaal Ahmad Zeeshan 13-Nov-14 13:15pm    
You can simply add them in your textual file. Then extract the lines from your text file.

Once extracted, use their index from the Array they were returned into.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900