Click Event

UltimateSearch

Collapse image Expand Image Copy image CopyHover image
Event handler for the user clicks.

Namespace: Karamasoft.WebControls.UltimateSearch
Assembly: UltimateSearch (in UltimateSearch.dll) Version: 3.7.4186.26690

Syntax

C#
public event EventHandler Click
Visual Basic
Public Event Click As EventHandler
Visual C++
public:
 event EventHandler^ Click {
	void add (EventHandler^ value);
	void remove (EventHandler^ value);
}

Examples

This sample shows how to handle the user clicks on the search button.
CopyC#
private void InitializeComponent()
{
  this.UltimateSearchInput1.Click += new System.EventHandler(this.UltimateSearchInput1_Click);
  this.Load += new System.EventHandler(this.Page_Load);
}

private void UltimateSearchInput1_Click(object sender, System.EventArgs e)
{
  // Get search terms
  string searchTerms = UltimateSearchInput1.SearchTextBox.Text;

  // Check search terms
  if (searchTerms != "")
  {
      // Get search output page
      string searchQuery = UltimateSearchInput1.SearchOutputPage;

      // Check search output page
      if (searchQuery == null)
          searchQuery = Page.Request.Path;
      else
          searchQuery = Page.ResolveUrl(searchQuery);

      // Build query string
      if (searchQuery.IndexOf("?") == -1)
          searchQuery += "?usterms=" + searchTerms;
      else
          searchQuery += "&usterms=" + searchTerms;

      // If you display the RadioButtonList control to get the search type
      if (UltimateSearchInput1.SearchTypeList.Visible)
          searchQuery += "&ustype=" + UltimateSearchInput1.SearchTypeList.SelectedValue;

      // Redirect to search output page
      Page.Response.Redirect(searchQuery, true);
  }
}

See Also