Disabled "Filtered Parameter" drop-down in custom web part with connections

Alex Angas
  • Disabled "Filtered Parameter" drop-down in custom web part with connections Alex Angas

    I'm writing a web part that needs to use connections for processing values relating to a business object called a "Program Entity". It is supposed to take in an ID provided by a connected web part, perform some processing, then spit out a 'token' for consumption by a different connected web part. The token is just the ID in another format.

    I have the drop-down menu correctly displaying as follows:

    Connections -> Send Program Entity Token To -> ...
                -> Get Program Entity ID From -> ...
    

    When I select a web part in "Get Program Entity ID From", a dialog appears for me to choose a Filtered Parameter. However the dropdown of parameters is greyed out and just says "No Parameters". Note: the web part I'm trying to connect to is also custom and may not have been fully completed and tested for providing a value via a connection.

    Is there anything that explains why I'm unable to set up a connection? Here is the code for my web part:

    public class ProgramEntityTokenConverter : WebPart, ITransformableFilterValues
    {
        public bool AllowAllValue
        {
         get { return true; }
        }
    
        public bool AllowEmptyValue
        {
         get { return false; }
        }
    
        public bool AllowMultipleValues
        {
         get { return false; }
        }
    
        public string ParameterName
        {
         get { return "ProgramEntityToken"; }
        }
    
        public ReadOnlyCollection<string> ParameterValues
        {
         get { return new ReadOnlyCollection<string>(ConvertProgramEntityIDs()); }
        }
    
        [ConnectionProvider("Program Entity Token", "ProgramEntityToken", AllowsMultipleConnections = false)]
        public ITransformableFilterValues SetConnectionInterface()
        {
         return this;
        }
    
        private IList<string> ConvertProgramEntityIDs()
        {
         return null; // TODO
        }
    
        [ConnectionConsumer("Program Entity ID", "ProgramEntityID", AllowsMultipleConnections = false)]
        public void SetFilter(IFilterValues filterValues)
        {
         if (filterValues != null)
         {
          EnsureChildControls();
          List<ConsumerParameter> parameters = new List<ConsumerParameter>();
          parameters.Add(new ConsumerParameter("ProgramEntityID", ConsumerParameterCapabilities.SupportsSingleValue));
          filterValues.SetConsumerParameters(new ReadOnlyCollection<ConsumerParameter>(parameters));
         }
        }
    }
    

  • Now fixed by changing this line:

    parameters.Add(new ConsumerParameter("ProgramEntityID", 
        ConsumerParameterCapabilities.SupportsSingleValue));
    

    to this line:

    parameters.Add(new ConsumerParameter("ProgramEntityID", 
        ConsumerParameterCapabilities.SupportsSingleValue | 
        ConsumerParameterCapabilities.SupportsAllValue));
    

    The web part I was trying to connect to had the AllowAllValue property set to true which was clearly excluded by ConsumerParameterCapabilities.


    As an aside, I also tried:

    parameters.Add(new ConsumerParameter("ProgramEntityID", 
        ConsumerParameterCapabilities.SupportsMultipleValues | 
        ConsumerParameterCapabilities.SupportsAllValue));
    

    ... however the web part I'm connecting to has AllowMultipleValues set to false! It seems odd that ConsumerParameterCapabilities enforces possible connections according to AllowAllValue but AllowMultipleValues does not.

Tags
web-part development connected-web-parts
Related questions and answers
  • I have been developing on SP 2010 for a while now. Mostly I have been working with the Client Object Model. Though I am at a point where I need to read out the UserProfiles from inside SharePoint. I see no other way to do this than to make a custom WCFService and deploy it to SharePoint. So that is what I did. I made an "Empty SharePoint Project" and added the mapped "ISAPI" folder. The code...; } This service gives a TimeOut error... When I delete the following line the TimeOut is fixed if (profile["FirstName"] != null) { } So I can only read out

  • I have a new SharePoint 2010 server farm that I'm trying to configure. Installation went fine. But I'm having trouble getting the user profiles to import. I've created the User Profile service application, and the two user profile services are running. However, whenever I try to create a synchronization connection to our AD servers, I'm getting the following error: "The operation was aborted because the client side timeout limit was exceeded." In the SharePoint logs, when I filter based on the correlation ID, I get the following messages: Name=Request (POST:http://poc-bi-sp:8080/_layouts

  • as expected. When I try to add a new item to the list, the list form only shows the Title field from Item. Now, here's the weird part. If I add a second content type to the list (through the UI), the list form suddenly works correctly. This makes me think there's something wrong with my content type. Here's what I'm working with. Some names have been changed to protect the innocent. <ContentType.... Scoped to Site. Registration: contains a ListTemplate and a ListInstance that just modifies a basic Custom List to enable content types and add my custom content type. Scoped to Web. Here's what's

  • I'm prototyping the best way to dynamically connect web parts at runtime. Essentailly, the application will allow for several disparate application groups to create web parts that will be consumed within the SharePoint front end. All of the web parts will need to automatically detect consumers and providers to create connections at runtime. What we are looking to do is have webparts discover... through each part creating consumer and provider connections for every webpart inheriting from the base class: SPWebPartManager spManager = SPWebPartManager.GetCurrentWebPartManager(Page

  • ;V1_I1_CP2;;T_sdja_%252F%252F0%252F%252F [4,["\n \n sdja",["\n \n sdja","","",-1],[true,[["sdja","",0,"",0,[["John Doe","CONTOSO\\sdja",1,"John Doe",""]]]],true],false,false,false],-1,false,false...Symptoms: You develop a browser-compatible InfoPath form with managed code for business logic. You use ContactSelector ActiveX control to look up and resolve users from the SharePoint site Users...%252F [4,["\n \n sdja",["\n \n sdja","","",-1],[true,[["","",0,"",0,[]],["sdja","",0,"",1,[["John Doe","CONTOSO\\sdja",1,"John Doe",""]]]],false],false,false,false],-1,false,false],[5

  • I have developed a custom SharePoint web service, and deployed it to /_vti_bin/myservice.asmx. As a "regular" user, browsing to that ASMX URL works fine. When I try to browse to "/_vti_bin... { [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Xml)] public XmlDocument GetInboxItems(string inboxName, string s_Id) { // code removed } } This is the art of my web part code where I am hooking up the ASP.Net AJAX stuff: ScriptManager scriptMgr = new ScriptManager(); string webUrl = SPContext.Current.Web.Url; ServiceReference srvRef = new ServiceReference(webUrl

  • down the route of using the ChangeLog. Now i'm doing this code: SPChangeQuery query = new SPChangeQuery(false, false); query.Item = true; query.Delete = false; query.Add = true; query.Update = true...I'm trying to pull back the last x number of list items in all non-hidden lists for a given web. My original code would go through all lists and run the following code: SPQuery query = new SPQuery... lists from a SPChangeQuery? Second question: Is there a faster / better way of doing this? I thought about using Auditing to get the data since I have that turned on for all of our site collections

  • Has anyone implemented IAlertUpdateHandler interface successfully? Actually I've to suppress alert subscription notification email. I've following code in PreUpdate method: public bool PreUpdate(SPAlert a, SPWeb web, bool newAlert, string properties) { if (CHECK_IF_SUPPRESSING_EMAIL) { a.Update(false); } else { a.Update(); } return true;//have tried returning false also } but I'm getting StackOverFlow exception as the method is called recursively. Any clues about what is going wrong? EDIT:- I've tried using PostUpdate also but got same results.

  • returned or page through them. So I need the Search Paging and Search Statistics web parts. Now both of these require connecting to the Search Core Results web part (according to MS documentation), however when I try to add a web part connection in SharePoint designer I get an error dialog saying: The Search Paging Web Part does not support connections. So how can I connect these up? I cannot...This is my first time working with the search components of SharePoint in much detail so any advice would be helpful here. I have a custom search results page created to match our corporate intranet

Data information