Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Laying out controls in SP 2003 Web Parts

Status
Not open for further replies.

markknowsley

Programmer
Aug 30, 2005
152
GB
Can anyone tell me if there is a better way to layout controls on web parts than the example below?

What I do at the moment is create a series of tables containing TableRow and TableCell. For example:

Code:
Table tbHeader = new Table();
TableRow tbHeaderRow1 = new TableRow();
TableCell tbHeaderRow1Cell1 = new TableCell();
TableCell tbHeaderRow1Cell2 = new TableCell();
Label lblForename = new Label();
Label lblSurname = new Label();
tbHeaderRow1Cell1.Controls.Add(lblForename);
tbHeaderRow1Cell2.Controls.Add(lblSurname);
tbHeaderRow1.Cells.Add(tbHeaderRow1Cell1);
tbHeaderRow1.Cells.Add(tbHeaderRow1Cell2);
tbHeader.Rows.Add(tbHeaderRow1);
Controls.Add(tbHeader);

This is just about manageable for a web part with a few controls, but it starts getting a bit silly when I want to do something like create a web part that captures ten pieces of information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top