SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to add a Lookup field. But in items adding it give me a one before last element of lookup field. In Items Added it works good, but i prefer to use a Items Adding, to then refresh site. Please help me how can I put a cascade lookup in Items Adding Event Receiver. Here is a Code:

                           SPListItem item = lstOtherList.Items.Add();
                           item["Kontrakt"] = properties.AfterProperties["Kontrakt1"];
                           item["Pracownik"] = properties.UserDisplayName;
                           item["Dzien"] = dzienStart;
                           item["Procenty"] = properties.AfterProperties["Procenty"];
                           SPList listaWpisy = properties.Web.Lists["Wpisy"];
                           SPListItemCollection listaKontrakty = listaWpisy.Items;
                           foreach (SPListItem kontrakt in listaKontrakty)
                               item["ID Czas Pracy Wpisy"] = new SPFieldLookupValue(kontrakt.ID, kontrakt.ID.ToString());
                           dzienStart = dzienStart.AddDays(1.0);

share|improve this question
any special reason you want to use item adding? going by this code snippet i dont find any reason to use synchronous event for this purpose – Diptarag Nov 21 '12 at 5:57
Because in my erly question some Person told that page reload can olny be use in item adding: SPUtility.Redirect("gzawistowskilap/SitePages/Close.aspx?IsDlg=1";, SPRedirectFlags.Default, current); And I must use a Page reload to update my DropDown List, after items add – Grzegorz Z Nov 21 '12 at 9:25
I now see that if i Use it at Items added i must refresh site to add the elements to the calendar. Maybe I can call it refresh in Items adding ? But how ? – Grzegorz Z Nov 21 '12 at 9:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.