public void Lookup_Selecting(DbField fld, ref string filter) {
if (fld.Name == "MyLookupField") {
fld.Lookup.UserSelect = "SELECT Field1 AS lf, Field2 AS df, Field3 AS df2, '' AS df3, '' AS df4 FROM Table1"; // Modify SELECT
fld.Lookup.UserOrderBy = "Field2 ASC"; // Modify ORDER BY
}
}
I’m trying to display additional fields in the lookup but save only the first two field in the table, but all four fields in my lookup get captured and overrides the field lookup,
How do I save only the first two fields even if lookup displays four fields.Thanks
Thanks I’ve manged to get it to show only lf… when i save it shows in the view page… but now when I go back to edit page the record is empty and have to enter again.
both fiels are VarChar…
no I mean that when you save the field the record shows in view… but when you then go back to edit the record disappears from the field, then have to re-enter the records. and then save again
I have checked the fields match the sequence of the fields in the lookup code match the fields in the aspnm field lookup table, i tried removing the fields, tried changing the link field, no matter what I do when i go back to the edit after a successful save, the records do not show and I have to re-enter.
Fields that do not use the code works and shows the old record.
You do not need the Lookup_Selecting codes. You should simply set up your lookup settings for use in the add/edit page and use the Row_Rendered server event to change the display value for the list/view page.