Using Unescaped CAML in a Data View Web Part (DWVP) in SharePoint Designer 2010

I’ve created more customized Data View Web Parts (DVWPs) than I could possibly count, but I still learn new stuff all the time. Tonight I was trying to get a DVWP to switch into DataSourceMode=”CrossList” and I accidentally noticed a nice little trick.

If you right-click on the DVWP and select Properties, a Tag Properties Task Pane will open up, probably in the bottom left or bottom right of your SharePoint Designer screen. If you click on the DataSource section, it’ll look something like this:

image

Note that the SelectCommand which I’ve highlighted is shown unescaped It seems that you can make edits there and SharePoint Designer will pass them into the DataSource section escaped, just as it must be.

I’ve used Notepad or XML escape Web pages or XML escaping apps to do this for years, and it turns out that SharePoint Designer would have done it for me all along. If that’s in some documentation somewhere, I challenge you to find it!

Similar Posts

5 Comments

  1. Hi Marc,

    I may be mistaken, but I don’t get the datasource properties when right-clicking the DVWP.
    However, if I select the datasource tag in the code in the codewindow, the tag properties window does show up with the properties, just as you describe.

    Am I missing something here?

    Regards,
    Ernst

    1. Ernst:

      You’re not missing anything. The Right-Click / Properties action opens the Tag Properties window, and then clicking on the DataSource section shows the properties for it specifically.

      M.

  2. Hi Marc, i have been reading a lot of ur posts, its really good.
    i am filtering data from text filter to a dataview webpart. its an external list.
    i can get the data by selection using Javascript client object model. Is there anyway to get the data without selecting .. by the way the filterd data is always one row. i just want to get these data in my javascript code so that i can do my rest of the update process… waiting for ur suggestions .. Thank You :)

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.