Grouping custom tool parts in with other custom properties
I have a webpart. I have a list of items (schools) th开发者_C百科at I must pick from. This list comes from another Sharepoint list. I made a tool part. This tool part creates a drop down list and populates it with the correct data. When I went to edit the web part properties, the drop down list is sitting outside of any other group. I want to add that drop down list into the "Miscellaneous" group. If I can't put it there, I want to create a custom group.
How do I do this?
To add other groups, you will need some client manipulations (jquery).
Or you can just create extra groups:
protected override void CreateChildControls() {
Panel panel = new Panel();
panel.CssClass = "ms-ToolPartSpacing";
Table table = new Table();
table.CellPadding = 0;
table.CellSpacing = 0;
table.Style["border-collapse"] = "collapse";
table.Attributes.Add("width", "100%");
TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.Controls.Add(new LiteralControl("<div class=\"UserSectionHead\"><b>Your Other Group:</b></div>"));
cell.Controls.Add(new LiteralControl("<div class=\"UserSectionBody\"><div class=\"UserControlGroup\">"));
Table innertable = new Table();
//build your innertable
cell.Controls.Add(innertable);
cell.Controls.Add(new LiteralControl("</div></div>"));
cell.Controls.Add(new LiteralControl("<div style='width:100%' class='UserDottedLine'></div>"));
row.Cells.Add(cell);
table.Rows.Add(row);
panel.Controls.Add(table);
this.Controls.Add(panel);
base.CreateChildControls();
}
精彩评论