locked
dataview webpart not showing "add new link" or "add new item" RRS feed

  • Question

  • Hi Team,

    i am working on data view webpart in sharepoint designer 2010. added links list as data source. i am not able to view the  "add new link"  icon at the bottom. how to add that link. i have added another custom list and tested dataview webpart but there also no "add new item" link is available. Thanks in advance.

    Tuesday, February 7, 2012 2:24 PM

Answers

  • Hi, and one example of markup and JS for the DVWPs body template could looks like this:

    <div>
    <script type="text/javascript"> 
    function openShoutBox() {
    var options = {
    url: &quot;/Lists/MyList/NewForm.aspx?RootFolder=&quot;,
    width: 800,
    height: 600,
    dialogReturnValueCallback: RefreshPage};
    SP.UI.ModalDialog.showModalDialog(options);
    }
    </script> 
    <a class="addNews" href="javascript:openShoutBox()"><img src="/MyCustomImages/AddItem.png" alt="" style="border:0px" />Add</a>
    </div>

    / C


    Blog: chrisstahl.wordpress.com Twitter: @Cstahl

    • Proposed as answer by teylyn [MVP]MVP Thursday, February 9, 2012 8:10 PM
    • Marked as answer by reddytcs Friday, February 10, 2012 6:43 AM
    Thursday, February 9, 2012 7:34 PM

All replies

  • Hi Team,

    we have a links list web part want to customize using data view web part. like removing the URL column name and replacing add new link icon with custom icons. do we need to write xslt for doing this changes. Thanks in advance
    • Merged by Entan Ming Wednesday, February 8, 2012 7:31 AM
    Tuesday, February 7, 2012 3:20 AM
  • Yes you need to update xslt to remove URL column name. Add the data view web part on the page. Add data source as your links list. Then you need to choose which columns needs to be displayed. After that if you click on column name, in the code window, you will see the column name inside<th> tag. You can then remove or update column name.

    To replace add new link with custom icons, try using jquery or javascript. You can refer to below link:

    http://techtrainingnotes.blogspot.in/2010/08/sharepoint-2010-change-add-new-item-and.html

    Tuesday, February 7, 2012 3:56 AM
  • Hi Supar,

    thanks for your suggestions they are working fine. i am using the dataview webpart and working on links list. can i know how to make the link item open in a new window. and when i am adding a links list as a datasource in dvwp i am not able to find add new link icon how to add the icon. thanks for your suggestions

    Tuesday, February 7, 2012 1:42 PM
  • Hi ,

    In order to open the link in a new window ,you can use JQuery on the page to open the links in a new window .When you add a data view web part (xsltlistviewwebpart)on a page ,you will not see the Add New Item link in SharePoint Designer .You can preview the page in browser .If the  Add New Item link is still not there ,you can edit the web part .Set the toolbox as ‘Full Tool Bar’ .

    For more information about open a link in a new window , please refer to this site:

    Opening a list item pdf attachment from the display form in a new window: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010customization/thread/dc97decf-1a97-4c18-92f8-7b65ee04524b/

    Thanks


    Entan Ming

    TechNet Community Support

    Wednesday, February 8, 2012 7:30 AM
  • Hello,
     

    as the name implies, the Data View Web Part is mainly for _viewing_ information. It does not automatically contain a link to add new items. You can manually add some html below or above it that will open a form to add an item. Just use the same URL that you see in the browser when you create a new item in the original list or from a List View Web Part.

    cheers, teylyn

    • Edited by teylyn [MVP]MVP Thursday, February 9, 2012 8:10 PM removed quote
    Thursday, February 9, 2012 8:52 AM
  • Hi, and one example of markup and JS for the DVWPs body template could looks like this:

    <div>
    <script type="text/javascript"> 
    function openShoutBox() {
    var options = {
    url: &quot;/Lists/MyList/NewForm.aspx?RootFolder=&quot;,
    width: 800,
    height: 600,
    dialogReturnValueCallback: RefreshPage};
    SP.UI.ModalDialog.showModalDialog(options);
    }
    </script> 
    <a class="addNews" href="javascript:openShoutBox()"><img src="/MyCustomImages/AddItem.png" alt="" style="border:0px" />Add</a>
    </div>

    / C


    Blog: chrisstahl.wordpress.com Twitter: @Cstahl

    • Proposed as answer by teylyn [MVP]MVP Thursday, February 9, 2012 8:10 PM
    • Marked as answer by reddytcs Friday, February 10, 2012 6:43 AM
    Thursday, February 9, 2012 7:34 PM
  • Hi Christian,

    I tried the above script its working great, thanks for your solution.

    Friday, February 10, 2012 6:44 AM