1

I am trying to create some sort of personalized Quicklinks which should be present on every page and containing links the user entered in there.

Though it should be on every page it needs to be in the Masterpage, this works good, so far.

But i am unable to save the values entered if it is in the Masterpage.

Usually i use this.SetPersonalizationDirty(). Used in MasterPage it says:

You must enable Web Parts by adding a WebPartManager to your page. The WebPartManager must be placed before any Web Part controls on the page.

But i was unable to insert one (DesignManager)

Another way i found is to use the SPLimitedWebPartManager:

        SPWeb web = SPContext.Current.Web;
        SPFile file =web.GetFile(HttpContext.Current.Request.Url.ToString());

        using (SPLimitedWebPartManager manager = file.GetLimitedWebPartManager(PersonalizationScope.User))
        {
            System.Web.UI.WebControls.WebParts.WebPart webPart = manager.WebParts[this.ID];
            ((QuickLinks)webPart).LinkJSON = this.LinkJSON;

            try
            {
                web.AllowUnsafeUpdates = true;
                manager.SaveChanges(webPart);
            }
            finally
            {
                web.AllowUnsafeUpdates = false;
            }
        }

Again not working in Masterpage. I even tried to replace this sites url with web.MasterUrl. Still no Luck.

Do you have any suggestions what to do to achieve this without the need of an external database?

Thank you

  • Have you looked into delegate controls? – Arsalan Shahid Jun 26 '15 at 16:43
  • With delegate controls i still have the issue where to save personalized user entries if not in a database. – Rafael Dabrowski Jul 2 '15 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.