Does Smartpart allow a consumer to have multiple providers, and how?

Sep 26, 2009 at 1:47 AM
Edited Sep 26, 2009 at 1:50 AM

Ive been working with SmartParts, and it beena  fairly pleasant experience.

 

I had one consumer/provider working, and decided to consume data from another Smartpart(2 providers -> 1 consumer). Its not working for me, and I dont know if it isnt supposed to work, or if Im doing something wrong.

 

Here is the consumer code. How would I differentiate between the data coming in?  I couldnt find any methods to do this.

 

//////   Consumer Code /////////////////////////////////////////////////////

 

    #region IConnectionConsumerControl Members

public string ConsumerMenuLabel
{
get { return "Receives text data from"; }
}

public void SetConsumerData(object data)
{
if (data != null)
if (data.GetType() == typeof(SmartPart.AJAXConnectionData))
{

SmartPart.AJAXConnectionData ajaxData = (SmartPart.AJAXConnectionData)data;

ajaxData.RegisterTriggerControls(this.UpdatePanel1);
//sdsCI.SelectParameters["ID"].DefaultValue = ajaxData.Data.ToString(); This was when I had a single provider, which worked

}
}

#endregion


 

/////   Provider Code  //////////////////////////////////////  Here is an example from one of the Providers. The other provider has basically the same code.

 

    #region IConnectionProviderControl Members
    public object GetProviderData()
    {


        if (ddlClients.SelectedIndex > -1)
        {
            return new SmartPart.AJAXConnectionData(
                ddlClients.SelectedItem.Value.ToString(), ddlClients, "SelectIndexChanged");
        }
        else
        {
            sdsClients.DataBind();
            ddlClients.DataBind();
            return new SmartPart.AJAXConnectionData(
                ddlClients.SelectedItem.Value.ToString(), ddlClients, "SelectIndexChanged");
        }
     
    }

    public string ProviderMenuLabel
    {
        get { return "Sends text data to"; }
    }

    #endregion