Solved

sharepoint 2010 make modified by link just text

Posted on 2012-12-26
2
363 Views
Last Modified: 2013-01-08
I am working on a project that has a XsltListViewWebPart on a page that was added programmtically.  This has strange security so I can't put the page in edit mode in the web interface and can't open it in designer.  I need the "modified by" link to display as text and not as a link.  I can edit the web part with the code below, but I am not sure how to access the xslt.  There is a property for a xlsturl, which apparen't can be set as a link to an xslt file.  If I could get a sample and place one someplace, that might work.  If not, I'd love another solution.  



            using (SPSite spSite = new SPSite("http://mysite"))
            {
                using (SPWeb spWeb  = spSite.RootWeb)
                {
                    spWeb.AllowUnsafeUpdates = true;
                    SPFile wikiFile = spWeb.GetFile("Pages/documents.aspx");
                    using (SPLimitedWebPartManager wpm = wikiFile.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared))
                    {
                        try
                        {
                            foreach (System.Web.UI.WebControls.WebParts.WebPart wp in wpm.WebParts)
                            {
                                var wp2 = (Microsoft.SharePoint.WebPartPages.XsltListViewWebPart) wp;
                                /*
                                if (wp.Title == "Shared Documents")
                                {
                                    wp.Title = "Project Documents";
                                    wpm.SaveChanges(wp);
                                }
                                */
                            }
                        }
                        catch
                        {
                            if (wpm.Web != null)
                            {
                                wpm.Web.Dispose();
                            }
                        }
                    }
                    spWeb.AllowUnsafeUpdates = false;
                }
            }
           
        }
0
Comment
Question by:jackjohnson44
2 Comments
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 38743506
Hi,
you should be able to set the Xsl via the property:
wp2.Xsl = "yourxslthere";
if you have propper permissions.
Perhaps you might try to set the property:
AllowXSLTEditing to true
and use SharePoint Designer to modify the Xslt.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.xsltlistviewwebpart_members%28v=office.14%29.aspx

HTH
Rainer
0
 

Author Comment

by:jackjohnson44
ID: 38755085
Thanks.  There is a place to link to a new xslt document, but that just didn't work.  I finally just used jQuery.

<script type="text/javascript">
    $(document).ready(function () {
        $('a[href*="userdisp.aspx"]').replaceWith(function() {
            return $(this).text();
        });
    });
</script>
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now