템플릿을 랩핑하고 현재 LayoutTemplate에있는 래퍼에 DataItem을 전달하려고합니다. 그러나 DataItem을 추가하려고 할 때 중단됩니다. 이유는 무엇입니까 (메신저가 아닌 사람) 그러나 준비가 끝나면이 GridView 함께 가능해야하지만 어떻게 해야할지 모르겠다 이것을 할 재작 성. 누군가가이 문제에 대한 해결책을 찾는데 도움을 줄 수 있습니까?ListView를 GridView로 변환
C#을
protected void rptListingAllMandatoryCourses_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem listItem = (ListViewDataItem)e.Item;
DataRowView dataItem = (DataRowView)listItem.DataItem;
}
}
당신이 제목 = ""과 설명 = ""내가 이상적 것과 같은 일부 데이터를 전달 할 위치가 표시되는 경우 : (이 휴식하지만 작동하지 않습니다) 지금까지에 와서 살아야 오늘 아침에이 자료를 공개해야 할 필요가있을 때 누군가가 도와 줄 수 있다면 이걸로 끝까지 읽으세요. 우리가 ListView를 계속 사용할 수 있다면 좋을 것입니다!
<%#DataBinder.Eval(Container.DataItem, "CatalogueTitle")%>
ASPX
<asp:ListView ID="rptListingAllMandatoryCourses" runat="server" OnItemDataBound="rptListingAllMandatoryCourses_ItemDataBound">
<LayoutTemplate>
<Catalogue title="" description="">
<div runat="server" ID="groupPlaceholder"></div>
</Catalogue>
</LayoutTemplate>
<GroupTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder" />
</GroupTemplate>
<ItemTemplate>
<Course>
<CourseTitle><a onclick="linkcourse("<%#DataBinder.Eval(Container.DataItem, "CourseID")%>");return false;" href="#" title="Launch <%# DataBinder.Eval(Container.DataItem, "CourseTitle")%>"><%# System.Web.HttpUtility.HtmlEncode((String)(DataBinder.Eval(Container.DataItem, "CourseTitle").ToString().Length > 25 ? DataBinder.Eval(Container.DataItem, "CourseTitle").ToString().Remove(22) + "..." : DataBinder.Eval(Container.DataItem, "CourseTitle")))%></a></CourseTitle>
<RatingsEnabled><%#DataBinder.Eval(Container.DataItem, "ratingsEnabled")%></RatingsEnabled>
<Rating><%#DataBinder.Eval(Container.DataItem, "rating")%></Rating>
<RatingCommentsEnabled><%#DataBinder.Eval(Container.DataItem, "ratingCommentsEnabled")%></RatingCommentsEnabled>
<Comment><%#DataBinder.Eval(Container.DataItem, "Comment")%></Comment>
</Course>
</ItemTemplate>
</asp:ListView>
입니다) %> "description =" "> GroupTemplate에서 마치 ItemTemplate에서 반복하는 것처럼 처리하고 단지 한 번만 래핑해야합니다. –