Showing Editing Links on a Multiple Item View in a DVWP

Laura Rogers over at EndUserSharePoint.com has a new series on the Data View Web Part (DVWP).  All of her posts are great, but the Data View Web Part, The Basics – Multiple Edit Forms one showed me something I didn’t know that I could do with SharePoint Designer just by making some dialog box choices: add editing links.

First, check out her post above to find out how to display a multiple item form.  The part that really caught my eye, though, was the second section about the Editing tab.  Somehow I’ve never noticed that tab was even there.  I’ve accomplished what it lets you do by writing my own XSL, and it isn’t horribly hard, but if Designer will let you do this without any work, why not?

First, add a plain old multiple item view DVWP to your page.  Yes, that’s a view, not a form.  Then, on the Common Data View Tasks, click Data View Properties, and go to the Editing tab.  There you can decide if you’d like to:

  • Show edit item links
  • Show delete item links
  • Show insert item link

Depending on which you select, you’ll see something like the screenshot below (thanks for the image, Laura).  Each link lets you take actions on the items and save your changes right in the existing form (albeit with a browser refresh).  No need to visit EditForm.aspx.

clip_image001

From here, you may decide to style the links differently, use different words, or make the links images rather than just text, but you’ve got a nice, full featured multiple item edit form in just a few minutes, tops!  BTW, this UI choice is much safer than the Datasheet view, as your users have to click save once they’ve made their changes or they can use the ever-handy cancel.

Similar Posts

34 Comments

  1. Thats the entire point..I know all wud become easy using DVWP ,however the datasheet view is the only constraint..Is there a way I can present the data in DVWP in a grid format and let user insert,edit and delete records..

  2. Hi Marc

    Ive downloaded the budget wsp to my SP folder…I am running SP2007 designer with no access to server..Can you please guide as to how to check it out?

  3. Marc,

    Thank you for continuing to support this information. I need some advice on what to do. When I check the box to add the edit option, it puts in the spacer at the front of column names in the list. However, the “edit” link shows up at the end of the data line and all fields are shifted one to the left, putting them in the wrong columns. I got it to work on another form, but this concern is happening more often now as I create more forms. I tried moving the javascript code to its correct position, but then the WP crashes. Any suggestions?

    George

    1. George:

      This is an old post, and it’s about how to do this in SharePoint 2007.

      It sounds to me like you may have some custom CSS getting in the way. Have you looked at the generated markup to see if the edit link is indeed in the last column in the table?

      M.

      1. Yes, I am referring to SharePoint 2007 that is why . The corporation I am with just recently migrated to 2010, however, most sites are still 2007. I am only a novice to javascript. The pages I am creating use a DVWP. Once I have the columns in place, I activate the Edit option and then I get the error I described. Do you have any suggestions on what I should look for to resolve this? I’ve compared it to the correct model and adjusted the javascript code, but the web part breaks each time.

        1. Well, you shouldn’t have to do anything except check the box(es) to get this to work. What JavaScript are you changing?

          M.

          1. When I attempt to change the script, it’s more of moving the “Edit” command to in front of the first data column in code. When the web part breaks, I undo the previous action(s) until it works again. I guess if you have not had this problem, it is a good chance that you will not have an answer for me. That’s ok. Thank you for your time. I hope you have a great day.

            1. You must mean XSL? There are any number of things that could cause errors when you move things around. But like I said before, you shouldn’t have to move anything at all.

              I’d suggest that you enable the editing links when you first add the DVWP to the page. It could be that you’re changing some other settings first and that combination of changes is causing a problem.

              M.

              1. Marc, that solved it. Instead of adding it at the end, I added it to start and it worked. Thank you. I hope you have an awesome week.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.