For everyone who attend both my presentations this week on SharePoint 2010, Visual Studio 2010 and the developer productivity tools, a huge thank you for all the great feedback. I had a great time running both sessions and was happy to be able to interact with some of you after the sessions.

I received a lot of requests for posting the slides and demo scripts online and perhaps even a recording of the session itself. Good news, we do have a live recording available from the Vancouver SharePoint User Group session that ran during the evening. You can view the live recording here: http://vimeo.com/11150378.

If you’d like access to the powerpoint and the demo scripts, I’ve got good news there as well. They can be downloaded directly from here: Slides and Demos.

I will try to get back to everyone else that has emailed me since the session and left their business cards for more info within the next week! Thanks all.

 

This is a quick overview on how to add a column’s description to your custom edit and disp forms in SharePoint 2007.

List Name: Projects
Column Name: Status
Column Type: Lookup
Column Description: “Choose the status for this current project.”

To add a column to a form and display it’s contents, it’s pretty straight forward:

SPWeb web = SPContext.Current.Web;
SPList projects = web.Lists["Projects"];
SPListItem item = projects.GetItemById(Convert.ToInt32(Request.QueryString["ID"]));
 
// use this to grab the value, you can get either the ID or the Value in the column
SPFieldLookupValue status = new SPFieldLookupValue(Convert.ToString(item["Status"]));
lblStatus.Text = status.LookupValue;
 
// use this to grab the columns description, or any other property for that column
SPFieldLookup statusDesc = new SPFieldLookup(projects.Fields, "Status");
lblStatusDesc.Text = statusDesc.Description;

The above works great, but please note that the column name for the SPFieldLookup method requires the SharePoint Internal Field Name. So for example, if your column name was Project Status, and you created the column with the spaces, then it will be Project_x0020_Status.

Tagged with: