0

I'm making a series of web parts which will take parameters.

I've already made a twitter web part, and would like to make a series that make use of PickerTreeDialog to render contents of user selected lists and libraries.

My question is, the standard way of passing parameters to SharePoint is kind of ugly and confusing to the average user.

Is there a better way to do this? Don't need new functionality. I already have it working the vanilla way as shown here: http://onlinecoder.blogspot.com/2011/04/custom-properties-in-sharepoint-2010_7158.html

2 Answers 2

0

What about connections ?

Walkthrough: Creating Connectable Web Parts in SharePoint

1
  • From a visual standpoint, this gets the job done. However, it would mean adding an additional webpart for every webpart I create, and then having the user set up the connection. Maybe I can make use of that ITextBoxString somehow.
    – Wesley
    Sep 6, 2012 at 16:24
0

You can create a custom UI and pass parameters with GetLimitedWebPartManager

protected void setTwitterName_Click(object sender, EventArgs e)
{
    string Name = TwitterHandle.Text.Trim();

    if (!String.IsNullOrEmpty(Name))
    {
        using (var webPartManager = SPContext.Current.Web.GetLimitedWebPartManager("default.aspx",PersonalizationScope.User))
        {
            try
            {
                foreach (var twitterWebPart in webPartManager.WebParts.Cast<WebPart>().Where(webPart => webPart.Title == "Twitter").Cast<Twitter>())
                {
                    twitterWebPart.Name = Name;
                    webPartManager.SaveChanges(twitterWebPart);
                    PropertiesWebPart.Name = Name;
                    DisplayTweets();
                }
            }
            catch
            {
            }
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.