The following is the message from SanderSchutten:

Hi Lekman,
I came across your ExtendedLookup-control. Unfortunatly i noticed right-away that it didn't work correctly, because it pre-selected the wrong item in the dropdownbox. I think i've fixed the issue with:
protected override void CreateChildControls()
FieldInfo info = typeof(LookupField).GetField("m_dataSource",
BindingFlags.Instance | BindingFlags.NonPublic);
DataView ds = DataSource;
info.SetValue(this, ds);

SPFieldLookupValue v = (SPFieldLookupValue)this.ItemFieldValue;
if (v != null)
for (int idx = 0; idx < ds.Count;idx++ )
DataRowView dr = ds[idx];
if ((int)dr["ValueField"] == v.LookupId)
FieldInfo selectedValueIndex = typeof(LookupField).GetField("m_selectedValueIndex", BindingFlags.NonPublic | BindingFlags.Instance);
selectedValueIndex.SetValue(this, idx);
/*MethodInfo setFieldControlValue = typeof(LookupField).GetMethod("SetFieldControlValue", BindingFlags.NonPublic | BindingFlags.Instance);
setFieldControlValue.Invoke(this , new object[] {v});*/
this.Value = v;
Could you maybe add me as a contributor to your project.

Last edited Mar 10, 2009 at 10:11 AM by Lekman, version 1


sdsamna Oct 13, 2010 at 12:18 AM 
I think this bug still exists. The dropdown does not populate correctly after a initial value is set.