2 posts, 0 answers
  1. Luffy
    Luffy avatar
    28 posts
    Member since:
    Jun 2011

    Posted 04 Aug 2011 Link to this post

    Hi, I am urgently looking for solution for implementing the Application Scenario(twitter). I wouldnt wan't to hard code to search for the keywords for the tweets.

    But i want to pass in from a textbox/Session. Need help urgently.

      <script type="text/javascript">
    var $ = $telerik.$;
          function GetTweetes(keywords, numPosts, fnk) {
              var url = "http://search.twitter.com/search.json?q=" + keywords + "&rpp=" + numPosts + "&callback=?";
              $.getJSON(url, function(data) {
                  if ($.isFunction(fnk)) {
                      fnk.call(this, data.results);
          function OnClientShowing(sender, args) {
              GetTweetes("Ajax", 10, function(data) {
                  var rotator = $find("<%= tweetsRotator.ClientID %>");
                  var currentItems = rotator.get_items();
                  //scroll the rotator to the first item
                  $(data).each(function(i, post) {
                      //if there is such an item created already - simply replace the content with the latest one
                      var dataItem = data[i];
                      var htmlString = "<div class='wrapper'>" + "<img class='profilePic' src='" + dataItem.profile_image_url + "'></img>" + "<div class='text'>" + dataItem.text + "</div><div class='date'><span class='author'>" + dataItem.from_user + " | </span>" + dataItem.created_at + "</div></div>";
                      if (currentItems[i]) {
                          currentItems[i].get_element().innerHTML = htmlString;
                      else {
                          //create and add a new item in case there is no such in the rotator - e.g in this demo this will be needed only on first show but in more complex scenario, when the returned by twitter records have different length
                          var radRotatorItemData = {};
                          radRotatorItemData.Html = htmlString;
                          rotator.addRotatorItem(radRotatorItemData, i);
          function ShowNotification() {
              var notification = $find("<%= RadNotification1.ClientID %>");
  2. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 05 Aug 2011 Link to this post

    Hello Luffy,

     Please, note that your question is not directly related to RadControls but to Twitter API. For more dtails on how to use it in order to achieve your custom goals you could use its reference below:


    or search the net:


    For your particular question, the keyword which is passed for the search comes from the line below:

    GetTweetes("Ajax", 10, function(data) { ....

    and it is appended as such in the GetTweets method below:

    function GetTweetes(keywords, numPosts, fnk) {
              var url = "http://search.twitter.com/search.json?q=" + keywords + "&rpp=" + numPosts + "&callback=?";

    This being said, if e.g your input is called mySearchText you should pass its value in a manner similar to the following:

    var txtVal = $get("mySearchText").innerHTML;
    GetTweetes(txtVal, 10, function(data) {

    I hope that my reply is detailed enough and helpful.

    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. DevCraft R3 2016 release webinar banner
Back to Top