WebPart Personailtion Property Problem

Last post 06-29-2009 12:43 AM by Hong-Gang Chen - MSFT. 1 replies.

Sort Posts:

  • WebPart Personailtion Property Problem

    06-24-2009, 9:36 AM
    • Member
      point Member
    • amitgoel2k6
    • Member since 03-30-2008, 7:21 PM
    • Posts 14

    Hi,

    I am scratching my head for my the past 3 weeks on thsi problem but i have got no soultion.Can some one please help me in this.

    need to access the personal property of the webpart set by the user in the Ajax call. I have tried the below approach but I am unable to retrieve that successfully it is always returning the default value of the property.


    I am pasting the full code and code marked in bold gives me default value instead of  getting property


    Some one please help

     

     

     

    SPLimitedWebPartManager webPartManger;

                using (SPWeb web = ContextUtility.GetRootWeb())

                {

                    webPartManger = web.GetLimitedWebPartManager(PageURL, System.Web.UI.WebControls.WebParts.PersonalizationScope.User);

                }

     

     

                foreach ( Microsoft.SharePoint.WebPartPages.WebPart wp in webPartManger.WebParts)

                {

     

                    if (wp.IsClosed == false && wp.Visible == true)

                    {

                        if (wp.Title != UtilityConstants.SUMMARY_LINK_WEBPART_HIDE_TEXT)

                        {

                            if (wp.GetType().BaseType.Name == UtilityConstants.BASE_TARGETED_WEB_PART_CLASS_NAME)

                            {

     

     

                                PropertyInfo[] wpPropertyCollection = wp.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

     

                                foreach (PropertyInfo wpProperty in wpPropertyCollection)

                                {

                                    if (wpProperty.Name == UtilityConstants.BASETARGETWEBPART_DISPLAY_PROPERTY)

                                    {

                                        object value = (object)wpProperty.GetValue(wp, null);

                                        if (value.ToString() == "True")

                                            createXMLNode = true;

                                        else

                                            createXMLNode = false;

                                        break;

                                    }

                                }

                            }

                            else

                            {

                                createXMLNode = true;

                            }

                        }

                    }

               }

    Amit Goel
  • Re: WebPart Personailtion Property Problem

    06-29-2009, 12:43 AM
    Answer

    amitgoel2k6:
    SPLimitedWebPartManager
     

    It seems this is a Sharepoint problem, I suggest you post this problem on this forum,

    http://social.msdn.microsoft.com/forums/en-US/category/sharepoint/

    Hong-Gang Chen
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (2 items)