开发者

Sharepoint custom field type. Get current list item id

I am creating custom field type. I want to view a attachments when list item in display mode so:

create class:

public class Kolumna: SPFieldText
    {
        public Kolumna(SPFieldCollection field, string fName) 
            : base (field, fName)
        {   
            int fakeItemId =1;

            SPFolder folder = field.Web.Folders["开发者_JAVA百科Lists"].SubFolders[field.List.Title].SubFolders["Attachments"].SubFolders[fakeItemId];

            foreach (SPFile item in folder.Files)
            {
              // todo add to column value (?)
            }
        }

any idea how get current ListItem Id? And did you know whitch metod is run when sharepoint form get colum value? I try override GetFieldValueAsText and GetFieldValueAsHtml but no effect :/


Use like this :

  ((YourCustomFieldControlClassType)this.FieldRenderingControl).ListItem

to access the listitem inside the Custom FieldType class to access the current listitem which is getting processed.

Cheers!!

Sangeet Ahuja (www.sangeetahuja.com)


public override object GetFieldValue(string value) is called to retrieve the value of the custom field type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜