2012-09-11 2 views
0

.Net 표 행이 복수 행 대신 동일한 행에 추가되는 이유가 궁금합니다.다중 행을 원한다 .net 표

는 특히 문제는이 코드입니다 :

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

테이블은 WebControls.Table
라벨, 필드 및 제출하기가 TableRows
모든 TableCells을 포함 있습니다입니다. 내가 브라우저에서 볼 때

그러나 TR> "모든 행과 열"

</TR>

다음 두 개의 빈

< TR> <과 같이 표현된다 </tr> < tr> </tr>

꼬리표?

그래서 그것은 세포와 행의 모든 ​​컨텐츠를 추가하고 심지어 세 행을 추가하지만 어떤 이유로는 첫째

< 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> 
+1

당신은 결과 HTML의 일부가 보일 수 있는가? –

+0

좋아요. 내가 추가했습니다. – PNS

+0

좋습니다, 감사합니다. 추측해야만한다면,'AddAt' 함수는 실제로 테이블에 행을'추가 '하지 않는다고 말할 것입니다. 기존 행에 데이터를 추가합니다. –

답변

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); 
+0

thx 남자 – PNS

+0

PNS를 도와 드리겠습니다. –

관련 문제