Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

unable to read lookup column value in itemadded() event handler - object reference error

$
0
0

hi all,

 am working on a event receiver wherein i need to read a  look up column from the doc lib, the event reciver is fired correctly, [ itemadded eventhandler]  when i uploaded a  document from my custom web part.

after document is added into the document library along with few metadata columns -w hich contains lookup column, spfield choice, single line of text etc.. i have to read these columns and perform another logic.

but i am not able to read the lookup column .

can an one point me, whats i was missing . when i debugged the code,

if(mitem["mylookupcolumn"]  != null ) //here it throws object reference  error 

{ // my  logic }

 if (singleItem.Fields[mylookupcolumnname] is SPFieldLookup)

                {

 

                    SPFieldLookupValue spfieldLookUpValue = newSPFieldLookupValue(singleItem[mylookupcolumnnameas string); /// it thros the //error object reference error

  

                  selectedValue = spfieldLookUpValue.LookupValue.ToString();

                }

help is highly appreciated!


Das




Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>