User Id :    Password :      New Member   Forgot Password  
 
Introduction to Twitter Control in Ajax Control Toolkit
Description With twitter control you can display the recent tweets from a particular user by supplying the user's twitter screen name. Apart from this you can also display the result of the tweeter search.   No. of Views     8238
  Rating     0
Author Najmul Hoda   Posted On     17 Oct 2011
Tags ASP.NET,Ajax,Ajax Control,ASP.NET 4.0    

Sample Code   Download Code

 

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

 

About Author

About Author He is a team lead, having 8+ years of experience. He loves writing technical article for .Net developers. Najmul Hoda
No Photo
 
Country United States
Company BirlaSoft
Home Page http://www.magixchat.com

Rate this article

Rating options from poor, fair, good, very good to excelent.  
 

Comments

   
Write your comment here.
Comment
Verification Code