Field not found in a list - when method called from event reciever
Folks, I am retrieving information from a list. My code goes like this.. foreach(SPList entity in entities) { if(entity["UserName"]!=null) string test=entity["UserName"].ToString(); } If i call this method from a webpart i face no issues. If i call this method from a event handler i get an error saying UserName field not found. {Exception: Value does not fall within the expected range} My method takes two parameters GetListItems(SPUser User, string siteUrl) The method is in a common utility. Both my webpart and the event handler call it when required. While am debugging i came to know that the number of fields in the ListItemCollection(entities) is 68 when called from the webpart and 62 when i call the same method from the event handler. Has anybody faced this kind of thing before? Is there something we need to take care when calling the methods from webparts and Event handlers? Sreeharsha Alagani
February 12th, 2011 10:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics