protected void btnTwitter_Click(object sender, EventArgs e)
    {
        //public string[] messages;
        //public int[] countretweet;
        //public string[] geolocation;
        //public string ashtag;
        //public int[] avcount;
        //public string[] geo;
        //public DateTime[] dt;
        //public string[] platform;



        //twitterloading.Visible = true;
        loadingimage.Visible = true;
        btnTwitter.Visible   = false;
        string message      = "";
        string retweetcount = "";
        string favcount     = "";
        string coord        = "";
        string dt           = "";
        string platform     = "";



        string key;

        if (tbsearch.Text.Contains("#"))
        {
            key = "%23" + tbsearch.Text.Replace("#", "");
        }
        else
        {
            key = "%23" + tbsearch.Text;
        }


        var searchParameter = Search.GenerateSearchTweetParameter(key); // change teh parameter

        searchParameter.Lang                   = Language.English;
        searchParameter.SearchType             = SearchResultType.Mixed;
        searchParameter.MaximumNumberOfResults = 100;
        var    tweets  = Search.SearchTweets(searchParameter);
        Tweets twitter = new Tweets();

        foreach (var twit in tweets)
        {
            twitter.Hashtag      = key.Replace("%23", "");
            twitter.Message      = twit.Text;
            twitter.Countretweet = twit.RetweetCount;
            twitter.Favcount     = twit.FavouriteCount;
            if (twit.Coordinates != null)
            {
                double x = twit.Coordinates.Latitude;
                double y = twit.Coordinates.Longitude;
                coord = x + "," + y;
            }
            else
            {
                coord = "";
            }
            twitter.Geolocation = coord;
            twitter.UniqueID    = twit.Id;

            twitter.DT = twit.CreatedAt;
            platform   = twit.Source;

            if (platform.Contains("android"))
            {
                twitter.Platform = "Android";
                //twitter.platform[i] = "Android";
            }
            else if (platform.Contains("iphone"))
            {
                twitter.Platform = "Iphone";
                //twitter.platform[i] = "Iphone";
            }
            else if (platform.Contains("windows"))
            {
                twitter.Platform = "windowsphone";
                // twitter.platform[i] = "windowsphone";
            }
            else
            {
                twitter.Platform = "Others";
                //  twitter.platform[i] = "Others";
            }
            //twitterloading.Visible = false;
            twitter.insertTwitter(twitter);
            loadingimage.Visible = false;
            btnTwitter.Visible   = true;
        }
    }