It also adds a label to
display the snippet field and a label to display the URL field. It uses three separate data-binding
routines to accomplish the data loading: BindLink, BindSnippet, and BindUrl. Listing 13-5
presents the full source code.
Listing 13-5. The ResultItemTemplate.cs Class File
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ControlsBook2Lib.CH12.LiveSearchControls
{
///
/// Default ResultItemTemplate implementation used by a
/// Stock LiveSearch Lib Result control without a ItemTemplate
/// public class ResultItemTemplate : ITemplate
{
///
/// Method puts template controls into container control
/// ///
Outside control container to template items
CHAPTER 13 ?– P ACKAGI NG AND DEPLOYMENT 669
public void InstantiateIn(Control container)
{
HyperLink link = new HyperLink();
link.DataBinding += new EventHandler(BindLink);
container.Controls.Add(link);
container.Controls.Add(new LiteralControl("
"));
Label snippet = new Label();
snippet.DataBinding += new EventHandler(BindSnippet);
container.Controls.Add(snippet);
container.Controls.Add(new LiteralControl("
"));
Label url = new Label();
url.
Pages:
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856