Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm really not a Designer, but unfortunately, I have to design something. Any help will be much appreciated.

The Scenario:

I have a Page Layout with my own Content Type.

One of the Fields in the Content type is called "ArticleLink".

When editing the Page Layout, I've added thte ArticleLink in a Edit mode panel which works fine.

Now, I need to set a Attribute of a HTML Element to the value in the Articlelink column..

In other words, it has to look something like this:

<embed id="" src="<%$Resources:wss,Mycustomfield%>" width="500" height="375">

I know I can do it with Jquery/Javascript, but is there a proper way of doing it?

Thanks

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

Its an interesting question, and there are a few approaches, these are the ones that I would look at would be.

Write your own control which reads in your custom field value and spits out the embed html tag. You could then embed the control on the page in the following manner

<SharePoint:FieldValueEmbedElement ID="id" runat="server" FieldValue="ArticleLink"/>

This control could then read in the FieldValue property from SPContext.Current.ListItem["ArticleLink"]

Another approach would be to write an Expression Builder (see the following articles for more infomation:- - MSDN Article (http://msdn.microsoft.com/en-us/library/system.web.compilation.expressionbuilder.aspx) - Blog Article from Keir Gordon (http://www.keirgordon.com/post/Using-a-Custom-Expression-Builder-in-MOSS.aspx)

This would allow you to go:-

<embed id="" src="<% $SPListItemFieldValue:ArticleLink%>" width="500" height="375">

I think the second approach would be better and would be reusable.

Regards Simon

share|improve this answer
    
Thanks Simon. I think the first option is the best for me. I forgot that I have the ability to do a SPContext.Current.ListItem["ArticleLink"]. Thanks again –  Fox Aug 11 '11 at 13:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.