M
_MC_
Hi,
i want to structure two elements (each conists of 1 Label and 1 Textbox) in
an Table. As I use an Content Place Holder, i thought it is possible to add
the table via Controls.add(Literal). Literal consists of standard html code
like <table>, <tr>, etc.. Nevertheless Asp Net generates me now table in
html code, maybe you see my mistake in the code below. Thanks a lot!
_MC_
Literal tableStart = new Literal(); tableStart.Text =
"<table>";
Literal tableStop = new Literal(); tableStop.Text =
"</table>";
Literal rowStart = new Literal(); rowStart.Text = "<tr>";
Literal rowStop = new Literal(); rowStart.Text = "</tr>";
Literal jumpColumnStart = new Literal(); jumpColumnStart.Text = "<td>";
PlaceHolder2_EditableItems.Controls.Add(tableStart); // <table>
PlaceHolder2_EditableItems.Controls.Add(rowStart); // <tr>
for (int i = 0; i < columnNames.Count; i++) {
lastcount++;
Label infoLabel = new Label();
infoLabel.Text = "test1";
TextBox myValTextBox = new TextBox();
myValTextBox.Text = "test2"
PlaceHolder2_EditableItems.Controls.Add(jumpColumnStart); // <td>
PlaceHolder2_EditableItems.Controls.Add(infoLabel);
PlaceHolder2_EditableItems.Controls.Add(jumpColumnStart); // <td>
PlaceHolder2_EditableItems.Controls.Add(myValTextBox);
if (lastcount == tableColumns)
{
PlaceHolder2_EditableItems.Controls.Add(rowStop); // </tr>
PlaceHolder2_EditableItems.Controls.Add(rowStart); // <tr>
lastcount = 0;
}
}
PlaceHolder2_EditableItems.Controls.Add(tableStop);
i want to structure two elements (each conists of 1 Label and 1 Textbox) in
an Table. As I use an Content Place Holder, i thought it is possible to add
the table via Controls.add(Literal). Literal consists of standard html code
like <table>, <tr>, etc.. Nevertheless Asp Net generates me now table in
html code, maybe you see my mistake in the code below. Thanks a lot!
_MC_
Literal tableStart = new Literal(); tableStart.Text =
"<table>";
Literal tableStop = new Literal(); tableStop.Text =
"</table>";
Literal rowStart = new Literal(); rowStart.Text = "<tr>";
Literal rowStop = new Literal(); rowStart.Text = "</tr>";
Literal jumpColumnStart = new Literal(); jumpColumnStart.Text = "<td>";
PlaceHolder2_EditableItems.Controls.Add(tableStart); // <table>
PlaceHolder2_EditableItems.Controls.Add(rowStart); // <tr>
for (int i = 0; i < columnNames.Count; i++) {
lastcount++;
Label infoLabel = new Label();
infoLabel.Text = "test1";
TextBox myValTextBox = new TextBox();
myValTextBox.Text = "test2"
PlaceHolder2_EditableItems.Controls.Add(jumpColumnStart); // <td>
PlaceHolder2_EditableItems.Controls.Add(infoLabel);
PlaceHolder2_EditableItems.Controls.Add(jumpColumnStart); // <td>
PlaceHolder2_EditableItems.Controls.Add(myValTextBox);
if (lastcount == tableColumns)
{
PlaceHolder2_EditableItems.Controls.Add(rowStop); // </tr>
PlaceHolder2_EditableItems.Controls.Add(rowStart); // <tr>
lastcount = 0;
}
}
PlaceHolder2_EditableItems.Controls.Add(tableStop);