internal static void TestWebParts() { string url = "http://roxserver/sites/filterzen/default.aspx"; SPSite site = new SPSite(url); SPWeb web = site.OpenWeb(); roxority_FilterWebPart.OffSite = site; roxority_FilterWebPart webPart = new roxority_FilterWebPart(); FilterBase pageRequestFilter = FilterBase.Create("roxority_FilterZen.FilterBase+RequestParameter"); webPart.GetFilters().Add(pageRequestFilter); pageRequestFilter.Name = "Project"; pageRequestFilter.Enabled = true; pageRequestFilter.Set("ParameterName", "projects"); pageRequestFilter.Set("RequestMode", 3); webPart.SerializedFilters = FilterBase.Serialize(webPart.GetFilters()); webPart.DebugMode = true; webPart.ApplyToolbarStylings = false; webPart.AutoRepost = false; webPart.DynamicInteractiveFilters = 1; webPart.HtmlMode = 0; webPart.RememberFilterValues = false; webPart.Title = "foo"; SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager(url, PersonalizationScope.Shared); webPartManager.AddWebPart(webPart, "LeftZone", 0); webPartManager.CacheInvalidate(webPart, Storage.Shared); webPartManager.SaveChanges(webPart); }