Sharepoint list item querystring id using javascript
Easy way
Add this code in content editor webpart or content placeholder main in sharepoint designer(dispform.aspx or editform.aspx)
<script type="text/javascript">
var itemId = GetUrlKeyValue("ID");
alert(itemId);</script>
(OR)
Add this code in content place holder main(allitems.aspx,dispform.aspx.......) or content editor webpart
<script type="text/javascript">
//Call the javascript function in page load
onload=function()
{
var query = location.search.substring(1);
var SplitQuerry=query.split('&');
var SplitId= SplitQuerry[0];
var Id=SplitId.split('=');
alert(Id);
}
</script>
//Call the javascript function in page load
onload=function()
{
var query = location.search.substring(1);
var SplitQuerry=query.split('&');
var SplitId= SplitQuerry[0];
var Id=SplitId.split('=');
alert(Id);
}
</script>
No comments:
Post a Comment