Introduction to Twitter Control in Ajax Control Toolkit
Introduction
Today I was roaming around www.asp.net/ajax website to get myself updated with newly introduced controls in Ajax Control Tool Kit and found a most exciting control “Twitter Control”. I studied the control and did some experiment on it and then finally thought to share my experience with you guys.
Twitter control was introduced last month, in September 11; in the Ajax Control Tool Kit 4.0.
With this control you can display the recent tweets of a particular user by supplying the user's twitter screen name. Apart from this you can also display the result of the twitter search in it.
Now let me show you how twitter control works.
Step1. Create a page called ShowRecentTweets.aspx
Step2. Drag and drop Ajax control Tool kit on the page.
<asp:scriptmanager id="ScriptManager1" runat="server">
</asp:scriptmanager>
Step3. Drag and drop Twitter control on the page. It will look like this
<ajaxToolkit:Twitter
Mode="Profile"
ScreenName="dotnetlogix"
runat="server" />
Twitter Control has 2 modes: Profile and Search. By setting this property we can display tweets accordingly.
Here in the above code I have set the screen name to dotnetlogix to show recent tweets of dotnetlogix.
Step4. Now run the page you will see the screen like below.
Here in the above sceenshot you can see 5 recent tweets of dotnetlogix.
Step5. Now if you want to perform search operation, change Mode to search and pass the search value in Search property as below
<ajaxToolkit:Twitter
Search="AJAX CONTROL TOOLKIT"
Mode="Search"
runat="server" />
Now run the page and you will get this screen below.
By default twitter control shows 5 tweets, if you want to show more or less number of tweets you can set it using count property.
Twitter limits the number of times that you can interact with their API in an hour. Twitter has recommended that you should cache results on the server (https://dev.twitter.com/docs/rate-limiting). The default cache duration for search result is 5 minutes but you can modify the cache duration by setting CacheDuration property of the Twitter control.
Is'nt it interesting..... Hope you guys liked it.
Stay tuned for more..... Happy reading