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 want to create a custom column in sharepoint 2010. When it is added to a list view I need it to render a link that when clicked opens a sharepoint modal dialog using the client ui. I need to pass the Itemid to the modaldilaog that is opened. Is this possible?

All the best

share|improve this question
    
I doubt this is possible. Not using basic a basic Sharepoint list. You would need some JavaScript to accomplish this. Even if you could get the function call into the link (which I also doubt). I don't think there is any way to include the Javascript. You could do this if you wrote a custom page and web part. –  user879 Dec 8 '10 at 8:58
add comment

2 Answers

You can use computed field, for example field LinkTitleNoMenu can be rendered as

<Field ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Type="Computed" Name="LinkTitleNoMenu" DisplayName="FieldName"  DisplayNameSrcField="Title" AuthoringInfo="$Resources:core,Linked_Item;" SourceID="http://schemas.microsoft.com/sharepoint/v3" ReadOnly="TRUE" >
    <FieldRefs>
      <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title"/>
      <FieldRef ID="{9d30f126-ba48-446b-b8f9-83745f322ebe}" Name="LinkFileNameNoMenu"/>
    </FieldRefs>
    <DisplayPattern>
      <IfEqual>
        <Expr1>
          <LookupColumn Name="FSObjType"/>
        </Expr1>
        <Expr2>1</Expr2>
        <Then>
          <Field Name="LinkFilenameNoMenu"/>
        </Then>
        <Else>
          <HTML><![CDATA[<a onfocus="OnLink(this)" href="]]></HTML>
          <URL/>
          <HTML><![CDATA[" onclick="GoToLink(this);return false;" target="_self">]]></HTML>
          <Column HTMLEncode='TRUE' Name="Title" Default='$Resources:core,NoTitle;'></Column>
          <HTML><![CDATA[</a>]]></HTML>
          <IfNew>
            <HTML><![CDATA[<img src="/_layouts/[%=System.Threading.Thread.CurrentThread.CurrentUICulture.LCID%]/images/new.gif" alt="]]></HTML>
            <HTML>$Resources:core,new_gif_alttext</HTML>
            <HTML><![CDATA[" class="ms-newgif" />]]></HTML>
          </IfNew>
        </Else>
      </IfEqual>
    </DisplayPattern>
  </Field>
share|improve this answer
add comment

Yes, I think this is possible - but complicated. The tricky bit will be controlling rendering in the list view, but Hyperlink fields appear as, well, hyperlinks - and I don't see why you couldn't then put your javascript into the HREF.

It doesn't feel right, however. You're not really setting/storing a value there. It sounds more like a Calculated Column. Have you tried those?

If this is to show extra details about the item, have you considered adding another web part to the View form? Something like this, but showing data from your dialog?

share|improve this answer
add comment

Your Answer

 
discard

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