Solved

sharepoint 2010 make modified by link just text

Posted on 2012-12-26
2
377 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

730 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