How to Add Item ID Numbers in Sharepoint's Display Form PDF Print E-mail
Written by Stephanny   
Friday, 15 January 2010 13:15

There've been times where I've created list and wanted to add the ID number to the display form. I never really found away until now. I read a blog from PathtoSharePoint.com that explained it a little bit.

The steps below are much clear and easier to understand. Hope this helps.

  • Go to the list that contains your items.
  • Click on the item - now you should be in the display form
  • Go the url - the url should looks something like: http://domain/sites/test/Lists/New%Test%20Form/DispForm.aspx?ID=267.....
    • Highlight - from http to aspx and delete the rest. Your URL should now look like this
    • http://domain/sites/test/ Lists/New%Test%20Form/DispForm.aspx
  • Now add ?ToolPaneView=2 to the URL to take you to the edit mode. Your URL should now look like this" http://domain/sites/test/ Lists/New%Test%20Form/DispForm.aspx?ToolPaneView=2
  • Click Go
  • You should now be in the edit mode for the display form
  • Click on Add a Web Part
  • Under Miscellaneous - check Content Editor Web Part
  • Click Add
  • In the Content Editor Web Part
    • Click Open the tool pane
    • The add the following scripts - I've copied from Path to SharePoint article
  • To view the ID in the first row - copy the code below:
<script type="text/javascript">

//

// Item ID in DispForm.aspx and EditForm.aspx

// Feedback and questions: Christophe@PathToSharePoint.com

//

function DisplayItemID()

{

var regex = new RegExp("[\\?&]"+"ID"+"=([^&#]*)");

var qs = regex.exec(window.location.href);

var TD1 = document.createElement("TD");

TD1.className = "ms-formlabel";

TD1.innerHTML = "<h3 class='ms-standardheader'>Issue ID</h3>";

var TD2 = document.createElement("TD");

TD2.className = "ms-formbody";

TD2.innerHTML = qs[1];

var IdRow = document.createElement("TR");

IdRow.appendChild(TD1);

IdRow.appendChild(TD2);

var ItemBody = GetSelectedElement(document.getElementById("idAttachmentsRow"),"TABLE").getElementsByTagName("TBODY")[0];

ItemBody.insertBefore(IdRow,ItemBody.firstChild);

}

 

_spBodyOnLoadFunctionNames.push("DisplayItemID");

</script>

        
To view the ID in the last row - past this code:
 
<script type="text/javascript">
//
// Item ID in DispForm.aspx and EditForm.aspx
// Feedback and questions: Christophe@PathToSharePoint.com
//
function DisplayItemID()
{
var regex = new RegExp("[\\?&]"+"ID"+"=([^&#]*)");
var qs = regex.exec(window.location.href);
var TD1 = document.createElement("TD");
TD1.className = "ms-formlabel";
TD1.innerHTML = "<h3 class='ms-standardheader'>Issue ID</h3>";
var TD2 = document.createElement("TD");
TD2.className = "ms-formbody";
TD2.innerHTML = qs[1];
var IdRow = document.createElement("TR");
IdRow.appendChild(TD1);
IdRow.appendChild(TD2);
var ItemBody = GetSelectedElement(document.getElementById("idAttachmentsRow"),"TABLE").getElementsByTagName("TBODY")[0];
ItemBody.appendChild(IdRow);
}
 
_spBodyOnLoadFunctionNames.push("DisplayItemID");
</script>

 

    • Click Ok
    • Click the plus + sign next to Layout
    • Click Hidden
  • Go back to the List
  • Click an item
  • And you should see the ID in the display form.


Add this page to your favorite Social Bookmarking websites
 

Comments  

 
0 #89 Lictciniort 2010-07-29 08:30
ford :: dental :: mac :: speakers :: nba :: tits :: vbulletin :: host :: snake :: vampire :: surface :: processor :: bathroom :: kawasaki :: race :: clark :: ron :: committee :: ip :: patterns ::
Quote
 
 
0 #88 Lictciniort 2010-07-29 07:33
pregnancy :: belly :: swedish :: event :: spice :: ladies :: stomach :: sharing :: quality :: late :: saw :: law :: happy :: lacrosse :: ellis :: trivia :: retro :: options :: tri :: 100 ::
Quote
 
 
0 #87 Lictciniort 2010-07-29 06:36
surface :: scan :: christ :: big :: weddings :: hotels :: chicks :: happy :: she :: scotia :: daytona :: long :: concepts :: dawn :: falling :: graphics :: cabinets :: debbie :: late :: publications ::
Quote
 
 
0 #86 Lictciniort 2010-07-29 05:39
length :: base :: distributor :: group :: m[censored] :: christmas :: auto :: peru :: daniel :: animation :: naples :: australia :: at :: row :: reader :: 16 :: tie :: samples :: greg :: rings ::
Quote
 
 
0 #85 Lictciniort 2010-07-29 04:42
enterprises :: ip :: biology :: crime :: opportunities :: shelter :: 16 :: women's :: life :: monitor :: promotion :: programming :: social :: showing :: animation :: transportation :: acne :: aaron :: actor :: rail ::
Quote
 
 
0 #84 Lictciniort 2010-07-29 03:45
dakota :: poster :: remove :: purchase :: pipe :: bernard :: artwork :: municipal :: students :: soccer :: p[censored]port :: cheese :: committee :: janet :: tags :: nintendo :: justice :: attorney :: alert :: pda ::
Quote
 
 
0 #83 Lictciniort 2010-07-29 02:47
latitude :: inn :: motels :: iraq :: software :: brush :: thailand :: belly :: celtic :: pumpkin :: carpet :: straight :: again :: heavy :: belt :: fund :: of :: haven :: shade :: away ::
Quote
 
 
0 #82 Lictciniort 2010-07-29 01:50
ny :: mitchell :: vietnam :: lawn :: delete :: inn :: rice :: flame :: hot :: rockford :: applications :: stickers :: hvac :: row :: fine :: paradise :: damage :: daily :: official :: stefan ::
Quote
 
 
0 #81 Lictciniort 2010-07-29 00:53
opera :: why :: written :: petersburg :: ballet :: hope :: hidden :: nations :: server :: greeting :: country :: holder :: philips :: trader :: doctors :: [censored] :: sewing :: language :: loss :: invitations ::
Quote
 
 
0 #80 Lictciniort 2010-07-28 23:55
gulf :: duke :: rockford :: men :: homemade :: using :: closing :: sisters :: keith :: celebrities :: delete :: dennis :: winston :: 17 :: meal :: mineral :: south :: spread :: st :: win ::
Quote
 

Add comment