문제

리피터 제어 내에 중첩 된 그리드 뷰 컨트롤이 있습니다.


리피터 컨트롤은 Pageload에서 데이터 라운드이며 ItemDatabound 이벤트에서는 GridView Control을 찾습니다.

if e.item.itemtype = listitemtype.item이면 gvw를 gridview = directcast (e.item.controls (3), gridview) gvw.datasource = getData () gvw.databind () END IF에

이 일이 발생한 후 내 페이지가 그리드 뷰에서 리피터 컨트롤 데이터와 데이터를 표시하지만 문제는 대체 그리드 뷰에만 데이터를 가지고 있습니다. 즉, 행 1, 3, 5 ... 리피터 컨트롤에는 데이터가 있지만 2, 4, 행이 있습니다. 6 ... 데이터가 표시되지 않습니다

마크 업은 - 예입니다

<repeater>
<itemtemplate>
<table>
<tr>
<td>
<gridview />
</td>
</tr>
<tr>
<td>
<label Text='<%# Eval("some_data") %>'
</td>
</tr>
</table>
</itemtemplate>
</repeater>

다시 위의 마크 업은 예제이며 완료되었습니다.

나는 심각한 잘못을하고 있다고 생각합니다.

도움이 되었습니까?

해결책

In your code

If e.Item.ItemType = ListItemType.Item Then Dim gvw As GridView = DirectCast(e.Item.Controls(3), GridView) gvw.DataSource = GetData() gvw.DataBind() End If

you should add an "OR" clause to check if the ItemType is an AlternateItem as well

If e.Item.ItemType = ListItemType.Item OR e.Item.ItemType = ListItemType.AlternateItem Then Dim gvw As GridView = DirectCast(e.Item.Controls(3), GridView) gvw.DataSource = GetData() gvw.DataBind() End If
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top