我搜索了Google,但我没有得到我的要求 我的输出像 现在我想显示喜欢 怎么做? 我有两个表,如 SystemUsers 和 UserSoftware 详细信息
SystemUsers 表具有 SystemUserName,DepartmentId,SystemId,SystemUserId UserSoftwareDetails 拥有 UserSwDetId,SystemUserId,Software,SoftwareKey
我的Aspx编码就像
<asp:ListView ID="ListView1" runat="server" GroupItemCount="3" GroupPlaceholderID="groupPlaceHolder1"
ItemPlaceholderID="itemPlaceHolder1">
<LayoutTemplate>
<table>
<asp:PlaceHolder runat="server" ID="groupPlaceHolder1"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<GroupTemplate>
<tr>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder1"></asp:PlaceHolder>
</tr>
</GroupTemplate>
<ItemTemplate>
<td >
<table cellpadding="2" frame="box" cellspacing="0" border="1" style="width: 300px; height: 150px; ">
<tr>
<td>
<b>User Name:</b> <span ><%# Eval("SystemUserName") %></span><br />
<b>Software: </b><span ><%# Eval("Software") %></span> <br />
<b>Software Key: </b><span ><%#Eval("SoftwareKey")%></span> <br />
</td>
</tr>
</table>
</td>
</ItemTemplate>
</asp:ListView>
如何获得此类输出?,
在此先感谢!!
答案 0 :(得分:0)
您的ASPX页面:
<asp:ListView ID="Business" runat="server" OnPagePropertiesChanging="OnPagePropertiesChanging">
<ItemTemplate>
<table cellpadding="0" cellspacing="0" >
<tr>
<td>
Username :
</td>
<td>
<%# Eval("SystemUserName")%>
</td>
</tr>
<tr>
<td>
Software :
</td>
<td>
<%# Eval("UserSoftwareDetails")%></b>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
// If you need Paging then add DataPager Ovehere
<asp:DataPager ID="DataPager1" runat="server" PagedControlID="Business" PageSize="9">
<asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="false" ShowPreviousPageButton="true"
ShowNextPageButton="false" />
<asp:NumericPagerField ButtonType="Link" />
<asp:NextPreviousPagerField ButtonType="Link" ShowNextPageButton="true" ShowLastPageButton="false"
</DataPager>
代码背后:
Bind your ListView (Write Stored Procedure To Display Records)
private void BindListView()
{
// Write your Code
}
protected void Page_Load(object sender, EventArgs e)
{
BindListView();
}
and if you are doing Paging
protected void OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
{
DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
this.BindListView();
}