I'm in the process of working thorugh Microsofts video tutorials for developing on Sharepoint. My actual small project is to create a visual Webpart which displays a list of all registered users with their display name, department and title.
This works like a charm. Now I want to improve the design of this little piece, just for the sake of it. So I created an . How can I put my rendered controls right into this Panel?
Below is the code which is executed when the Page loads.
public partial class PeoplePickerUserControl : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
string _department = null, _Title = null;
var serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
var userProfileManager = new UserProfileManager(serviceContext);
Controls.Add(new LiteralControl("<div class='ui-widget-header'>PeoplePicker<div class='ui-widget-content ui-corner-all'>"));
foreach (UserProfile userProfile in userProfileManager)
{
if (userProfile[PropertyConstants.Department].Value != null)
_department = userProfile[PropertyConstants.Department].Value.ToString();
else _department = "";
if (userProfile[PropertyConstants.Title].Value != null)
_Title = userProfile[PropertyConstants.Title].Value.ToString() + ", ";
else _Title = "";
Controls.Add(new LiteralControl("<p><fieldset>"+ " " +"<a href='" + userProfile.PublicUrl + "'>"+ userProfile.DisplayName + "</a><br />"
+ _Title + _department + "</fieldset></p>"));
}
Controls.Add(new LiteralControl("</div></div>"));
}
}
<asp:Panel ID="staffContentInHerePanel" runat="server">
// Content should be put in here
</asp:Panel>
As you can see I am rendering two divs, which I want to be styled with JQuery. This part shall be exported into the .ascx file.
Thank you in advance.