Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

What about connections ?

Walkthrough: Creating Connectable Web Parts in SharePoint

share|improve this answer
    
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 '12 at 16:24
add comment
up vote 0 down vote accepted

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
            {
            }
        }
    }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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