savan patel

savan patel

  • NA
  • 14
  • 3.4k

Set unique value for Sharepoint custom property of web part

Apr 1 2015 1:02 AM
I want Set diffrent value for Sharepoint custom property of same web part in multiple diffrent pages

I have visual web part and i am attempting to set custom property unique value on each pages. For example i have two aspx pages. Deal.aspx and Fund.aspx. Both page is having same web part used. When i set the value custom property in web part of Deal.aspx the same value gets reflect in Fund.aspx page web part as well. I read about PersonalizationScope but it did not help for my scenario. Below is  the custom property i have created.

        public static string ListName;
        [Category("Extended Settings"),
        Personalizable(PersonalizationScope.User),
        WebBrowsable(true),
        WebDisplayName("Enter List Name"),
        WebDescription("Please Enter a List Name")]

        public string _ListName
        {
            get { return ListName; }
            set
            {
                // Sample Validation
                Regex oRegEx = new Regex("[a-zA-Z]+");
                if (!oRegEx.IsMatch(value))
                    throw new Microsoft.SharePoint.WebPartPages.
                        WebPartPageUserException(
                        "Please enter alphabeth characters only");
                ListName = value;
            }
        }

I will highly appreciate the help. Any thoughts ?

Answers (1)