3 using System.Configuration;
4 using System.Collections;
5 using System.Collections.Specialized;
8 using System.Web.Security;
10 using System.Web.UI.WebControls;
11 using System.Web.UI.WebControls.WebParts;
12 using System.Web.UI.HtmlControls;
13 using System.Xml.Linq;
14 using System.Web.DynamicData;
16 public partial class ForeignKey_EditField : System.Web.DynamicData.FieldTemplateUserControl {
17 protected void Page_Load(object sender, EventArgs e) {
18 if (DropDownList1.Items.Count == 0) {
19 if (!Column.IsRequired) {
20 DropDownList1.Items.Add(new ListItem("[Not Set]", ""));
23 PopulateListControl(DropDownList1);
27 protected override void OnDataBinding(EventArgs e) {
28 base.OnDataBinding(e);
30 if (Mode == DataBoundControlMode.Edit) {
31 string foreignkey = ForeignKeyColumn.GetForeignKeyString(Row);
32 ListItem item = DropDownList1.Items.FindByValue(foreignkey);
34 DropDownList1.SelectedValue = foreignkey;
39 protected override void ExtractValues(IOrderedDictionary dictionary) {
40 // If it's an empty string, change it to null
41 string val = DropDownList1.SelectedValue;
42 if (val == String.Empty)
45 ExtractForeignKey(dictionary, val);
48 public override Control DataControl {