重複的項目我都綁定到看起來像這樣一些XML數據的GridView控件:顯示在GridView
<Root>
<Column1>
<Item1 type="l1style">Item 1</Item1>
<Item2 type="l2style">Item 2</Item2>
<Item3 type="l3style">Item 3</Item3>
</Column1>
<Column2>
<Item4 type="l1style">Item 4</Item4>
<Item5 type="l2style">Item 5</Item5>
</Column2>
<Column3>
<Item6 type="l1style">Item 6</Item6>
<Item7 type="l2style">Item 7</Item7>
</Column3>
</Root>
在某些情況下,雖然,欄3點是不存在的。
我想呈現類似:
<table>
<thead>
<tr>
<th scope="col">Column1</th>
<th scope="col">Column2</th>
<th scope="col">Column3</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li class="l1style">Item 1</li>
<li class="l2style">Item 2</li>
<li class="l3style">Item 3</li>
</ul>
</td>
<td>
<ul>
<li class="l1style">Item 4</li>
<li class="l2style">Item 5</li>
</ul>
</td>
<td>
<ul>
<li class="l1style">Item 6</li>
<li class="l2style">Item 7</li>
</ul>
</td>
</tr>
</tbody>
</table>
如何Repeater控件被內部使用的GridView控件的,或者是有沒有更好的方式來做到這一點?謝謝。
如果我把一個Repeater放在TemplateField中,我怎樣才能將它的數據源設置爲當前列(第1,2列和[有時] 3)? – Bullines 2009-09-09 00:57:25
你可以在一個文字中使用<%#Bind(「fieldname」)%>,但我不確定這是做這件事的最好方法。用一箇中繼器替換gridview是一個大問題?中繼器比gridview更簡單,重量更輕,速度更快。 – Steve 2009-09-09 15:57:14