Databases Reference
In-Depth Information
}
}
Listing 11.9 shows the complete code-behind file of the Region_Edit field template,
updated to support the CountryField parameter. Notice that the template class now has a
matching public property, which is automatically initialized by the UnleashedControl
based on the property metadata.
LISTING 11.9 Region_Edit Field Template Extended with CountryField Parameter
using System;
using System.Collections.Specialized;
using System.Web.UI;
namespace WebApplication.DynamicData.FieldTemplates
{
public partial class RegionEditField : UnleashedFieldTemplate
{
private UnleashedFieldTemplate countryTemplate;
public string Country
{
get { return this.autoCompleteExtender.ContextKey; }
set { this.autoCompleteExtender.ContextKey = value; }
}
public string CountryField { get; set; }
public override Control DataControl
{
get { return this.textBox; }
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
this.textBox.ToolTip = this.Column.Description;
this.SetUpValidator(this.requiredFieldValidator);
this.SetUpValidator(this.dynamicValidator);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.countryTemplate = this.FindOtherFieldTemplate(this.CountryField);
Search WWH ::




Custom Search