kamagra how much to take

Getting Raw Field Values From SPListItem Or SPDataSourceViewResultItem

This method is helpful when you are working with the two different types, SPDataSourceViewResultItem providing custom type information:

  1.  public object GetRawFieldValue(SPListItem item)
  2.         {
  3.             object fieldValue = null;
  4.             if (item != null)
  5.             {
  6.                 SPField fieldByInternalName = item.Fields.GetFieldByInternalName(InternalName);
  7.                 if (fieldByInternalName != null)
  8.                 {
  9.                     fieldValue = item[fieldByInternalName.Title];
  10.                 }
  11.             }
  12.             return fieldValue;
  13.         }
  14.  
  15.         public object GetRawFieldValue<T>(T item)
  16.         {
  17.             object rawFieldValue = null;
  18.             if (item is SPListItem)
  19.             {
  20.                 SPListItem listItem = item as SPListItem;
  21.                 return GetRawFieldValue(listItem);
  22.             }
  23.             if (item is SPDataSourceViewResultItem)
  24.             {
  25.                 SPDataSourceViewResultItem dataSourceViewResultItem = item as SPDataSourceViewResultItem;
  26.                 rawFieldValue = GetRawFieldValue(dataSourceViewResultItem);
  27.             }
  28.             return rawFieldValue;
  29.         }
  30.  
  31.         public object GetRawFieldValue(SPDataSourceViewResultItem item)
  32.         {
  33.             object rawFieldValue = null;
  34.             SPListItem spListItem = item.ResultItem as SPListItem;
  35.             if (spListItem != null)
  36.             {
  37.                 rawFieldValue = GetRawFieldValue(spListItem);
  38.             }
  39.             return rawFieldValue;
  40.         }
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>