Search Box Web Part

The Search Box Web Part lets shoppers search the catalog and static content of the site. Shoppers can select the applicable categories or all categories, enter a free-form text phrase, and initiate the search by clicking enter or the "Go" button.

You must also add a Search Results Web Part to the page to implement the Search Feature.

You can also put the Search Results Web Part on a different page but this requires that you set the SearchResultPageUrl parameter to point to the new page.

This is a user control-based Web Part.

Architecture

The Web Part updates the URL query string parameters and submits the page.

Properties

Property

Maps to

"All categories" drop-down option text

AllCategoriesText

"Category" label text

CategoryLabelText

CSS class

CssClass

Initial search box text

DefaultSearchText

"Search phrase" label text

FreeTextLabelText

"Search phrase" maximum length

FreeTextMaxLength

Category drop-down root category

RootCategory

"Search Results" page URL

SearchResultsPageUrl

"Search" button image URL

SearchSubmitButtonImageUrl

SearchSubmitButtonText

SearchSubmitButtonText

Display "Category" drop-down

ShowCategoryList

Customization

You can customize the Search Box Web Part by modifying the SearchBox.ascx file by using HTML and CSS in the actual control.

Error Handling

The Search Box Web Part returns friendly error messages when required fields have not been supplied.

API Dependencies

Not applicable.

See Also

Other Resources

Developing with SharePoint Commerce Services

Catalog System Web Parts

Working With the Search Box Web Part