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 am having a SharePoint site and i had added a custom aspx page and I want to show the announcement list items in that page. How to show the list items in a custom page ?. Helpful links and sample code would be helpful?

share|improve this question
add comment

3 Answers 3

As far as I know you can't add a SharePoint list to a custom ASP.NET page however you can display list items on that custom page if your using SharePoint 2010 using user client object model,

MSDN client object model

Make sure you use a custom ASP.NET page and in code behind create a asp.net list just like announcement list (depends on your requirements) and then query announcement list that you either created in a site collection and add items to custom asp.net list.

hope it helps :).

share|improve this answer
add comment

You can edit the page and add the announcement list as a webpart.

Site Actions > Edit Page > Click 'Add a webpart'(for webpart page) > Click 'Insert' tab in ribbon > Select 'WebPart' > List and libraries > select the announcement list and click OK.

share|improve this answer
    
Hi Paddy thanks for the quick response. I am not using a SharePoint page rather I am using a custom aspx page which i had added in the layouts folder. How can i edit a custom aspx page? –  anantharengan Dec 26 '12 at 9:37
    
Access the page from Internet Explorer -> Site Actions -> Edit Page –  Arsalan Adam Khatri Dec 26 '12 at 9:47
    
He can't as its a custom asp.net page not SharePoint :) –  Muhammad Raja Dec 26 '12 at 9:55
    
Hi Arsalan Adam Khatri and TimeToShine Thanks for the quick response. As TimeToShine rightly pointed it is a SharePoint page,hence I am not able to edit the page and add the Announcement Web Part. Any idea of how to show the Web Part on a custom page? –  anantharengan Dec 26 '12 at 10:03
    
For a custom page.. you can have a web part zone in it so that you can add the announcement list to it... –  Strider Dec 26 '12 at 14:02
add comment
up vote 0 down vote accepted

I found a solution for my requirement. I had used XsltListViewWebPart for displaying announcement list in custom application page. I would like to thank everyone who offered me their advice thanks a lot.

The following link did it for me

http://suryapulipati.blogspot.in/2011/08/sharepoint-2010-show-add-new-item-or.html

share|improve this answer
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.