0

.Netテーブルの行が複数行ではなく同じ行に追加されるのはなぜですか?

特に問題はこのコードにあります:

this.table.Rows.AddAt(0,labels);
this.table.Rows.AddAt(1,fields);
this.table.Rows.AddAt(2,submits);

tableはWebControlsです。Table
のラベル、フィールド、および送信は、
すべてTableCellを含むTableRowsです。

しかし、ブラウザで見ると、<tr>「すべての行と列」のように表されます。

</ tr>

そして2つは空です

<tr> </ tr> <tr> </ tr>

タグ..?

したがって、セルと行のすべてのコンテンツを追加し、3行も追加しますが、何らかの理由ですべての情報を最初に追加します

<tr>タグ。

私が間違っていることについて何か考えはありますか?

<table border="0">
        <tr>
            <td><span>please enter the title of the interaction here</span></td><td><span>please enter the description of the interaction here</span></td><td><span>please select the impact level of the interaction here</span></td><td><span>please select the urgency level of the interaction here</span></td><td><span>please enter the contact of the interaction here</span></td><td><input name="ctl00$PlaceHolderMain$ctl00$ctl06" type="text" value="one" /></td><td><input name="ctl00$PlaceHolderMain$ctl00$ctl07" type="text" value="two" /></td><td><select name="ctl00$PlaceHolderMain$ctl00$ctl08">
                <option selected="selected" value="1">Low</option>
                <option value="2">Medium</option>
                <option value="3">High</option>

            </select></td><td><select name="ctl00$PlaceHolderMain$ctl00$ctl09">
                <option selected="selected" value="1">Low</option>
                <option value="2">Medium</option>
                <option value="3">High</option>

            </select></td><td><input name="ctl00$PlaceHolderMain$ctl00$ctl10" type="text" value="con" /></td><td rowspan="3"><input type="submit" name="ctl00$PlaceHolderMain$ctl00$ctl11" value="Create Interaction" /></td><td rowspan="2"><span>No interactions created yet</span></td>
        </tr><tr>

        </tr><tr>

        </tr>
    </table>
4

1 に答える 1

1

セルコンテナを渡すことで、このコードを試すことができます

/adding first row
TableRow row1 = new TableRow();

//adding first cell
TableCell cell1 = new TableCell();

//adding label
Label text1 = new Label();
text1.Text = "Just test";

cell1.Controls.Add(text1);
row1.Controls.Add(cell1);
table1.Controls.Add(row1);
于 2012-09-11T13:43:34.127 に答える