The LiveSearchSearch.cs Code-Behind Class File
using System;
namespace ControlsBook2Web.Ch12
{
public partial class LiveSearch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
674 CHAPTER 13 ?– PACKAGING AND DEPLOYMENT
Customizing the Live Search Controls??™ Appearance
The Live Search controls we produced provide extensive support for customization through
styles, templates, and data-binding overrides. The next web form demonstration takes
advantage of all three features. The CustomLiveSearch web form implements its own version of
ItemTemplate, AlternatingItemTemplate, and StatusTemplate to show a numbered list of the
search results on the left side and a different color for each alternating row.
The work of keeping the item index is performed in the code-behind class file that links up
to events exposed by the Search and Result controls. It resets the resultIndex variable when
either Search or Result raises the LiveSearchSearched event. Then, on each ItemCreated event
raised by the Result control, it increments its counter and inserts the number at the head of the
ResultItem content for each row as part of the user interface. Figure 13-7 shows the result.
Figure 13-7. The result of the LiveSearch.
Pages:
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860