markknowsley
Programmer
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:
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.
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.