Пример #1
0
        private void ShowErrorMessage()
        {
            //Clear out the fact that the user did a search before this.
            Keyword = "";
            OldKeywords.Clear();

            lblResultsForKeyword.Text         = "";
            lblTopResultsXofYKeyword.Text     = "";
            lblSearchWithinResultKeyword.Text = "";

            phError.Visible = true;
            ShowResultsXoYLabels(0, 0, 0);
            //For paging change.
            PreviousItemsPerPage = ItemsPerPage;

            //Set the Search Within Results Radio button to new search
            rblSWRSearchType.SelectedIndex = 0;
            spPager.RecordCount            = 0;

            //// Web Analytics *************************************************
            // Add number of search results to analytics
            this.PageInstruction.SetWebAnalytics(WebAnalyticsOptions.eVars.evar10, wbField =>
            {
                wbField.Value = "0";
            });
            //// End Web Analytics *********************************************
        }
Пример #2
0
        private void DoSearchWithinResults()
        {
            if (Strings.Clean(txtSWRKeyword.Text) == null)
            {
                ShowErrorMessage();
            }
            else
            {
                if (rblSWRSearchType.SelectedValue == "2") //Search Within Results
                {
                    //Add the last keyword to the old keywords
                    if (!String.IsNullOrEmpty(Keyword))
                    {
                        OldKeywords.Add(Keyword);
                    }

                    //Set the current keyword
                    Keyword = Strings.Clean(txtSWRKeyword.Text);

                    LogUserInput("Refine-Keyword:" + (
                                     OldKeywordsForQuery.Length > 0 ? OldKeywordsForQuery + "|" + Keyword : Keyword));
                }
                else //New Search
                {
                    //Log new search
                    OldKeywords.Clear();
                    Keyword = Strings.Clean(txtSWRKeyword.Text);

                    LogUserInput("New-Keyword:" + Keyword);
                }

                this.CurrentPage   = 1;
                txtSWRKeyword.Text = ""; //Clear the text box.  .NET will leave in the text, which is what google does, but not what cancer.gov has done.

                LoadResults();
            }
        }