Sunday, March 17, 2013

Web Resource Lookup
We use a list to keep track of our lists on SharePoint site.
1. A custom field is developed to help user to automatically pick the list from the site.
 
 
 
2. User can pick the web name from the custom field and the list name from the custom field.
 


 
 
3. The custom field not only record the selection but also create a hyperlink to the resource.
 
The trick of this project is to use SPFieldMultiColumn to maintain the Web Site ID and List ID internally while showing the display names.
 
public class WebResourceField : SPFieldMultiColumn{
public WebResourceField(SPFieldCollection fields, string fieldName)
: base(fields, fieldName)
{ }
public WebResourceField(SPFieldCollection fields, string fieldName, string displayName)
: base(fields, fieldName, displayName)
{
}
public override BaseFieldControl FieldRenderingControl
{
get

{
BaseFieldControl control = new CategoryListsFieldControl();
control.FieldName = this.InternalName;
return control;
}
}
}



No comments:

Post a Comment