!小弟自己做的datalist分页显示数据库图片,但是浏览时空白页
求助!!小弟自己做的datalist分页显示数据库图片,但是浏览时空白页
如题,自己做毕设,想做一个分页的datalist显示数据库图片(用的url方式),但是代码打完,在ie中查看是空白页,求大神帮我看看啊,还有10天就交了啊!!!急急急急
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="DataList1" runat="server"
onitemcommand="DataList1_ItemCommand"
onitemdatabound="DataList1_ItemDataBound">
<FooterTemplate>
<asp:Label ID="labCurrentPage" runat="server" Text="Label"></asp:Label>
<asp:Label ID="labPageCount" runat="server" Text="Label"></asp:Label>
<asp:LinkButton ID="lnkbtnFirst" runat="server">首页</asp:LinkButton>
<asp:LinkButton ID="lnkbtnFront" runat="server">上一页</asp:LinkButton>
<asp:LinkButton ID="lnkbtnNext" runat="server">下一页</asp:LinkButton>
跳转至:<asp:TextBox ID="txtPage" runat="server"></asp:TextBox>
<asp:LinkButton ID="lnkbtnLast" runat="server">尾页</asp:LinkButton>
<asp:Button ID="Button1" runat="server" Text="Go" />
</FooterTemplate>
<ItemTemplate>
<table class="style1">
<tr>
<td>
<!--<asp:Image ID="Image1" runat="server" ImageUrl =<%#DataBinder.Eval(Container.DataItem,"iamgeurl")%>/>-->
<img src='images/<%#DataBinder.Eval(Container.DataItem,"imageurl")%>'/>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>
后台
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class datalist分页 : System.Web.UI.Page
{
protected static PagedDataSource pds = new PagedDataSource();//创建一个分页数据源的对象且一定要声明为静态
protected void Page_Load(object sender, EventArgs e)
{
}
private void BindDataList(int currentpage)
{
pds.AllowPaging = true;
pds.PageSize = 3;
pds.CurrentPageIndex = currentpage;
string connStr = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
如题,自己做毕设,想做一个分页的datalist显示数据库图片(用的url方式),但是代码打完,在ie中查看是空白页,求大神帮我看看啊,还有10天就交了啊!!!急急急急
<head runat="server">
<title></title>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="DataList1" runat="server"
onitemcommand="DataList1_ItemCommand"
onitemdatabound="DataList1_ItemDataBound">
<FooterTemplate>
<asp:Label ID="labCurrentPage" runat="server" Text="Label"></asp:Label>
<asp:Label ID="labPageCount" runat="server" Text="Label"></asp:Label>
<asp:LinkButton ID="lnkbtnFirst" runat="server">首页</asp:LinkButton>
<asp:LinkButton ID="lnkbtnFront" runat="server">上一页</asp:LinkButton>
<asp:LinkButton ID="lnkbtnNext" runat="server">下一页</asp:LinkButton>
跳转至:<asp:TextBox ID="txtPage" runat="server"></asp:TextBox>
<asp:LinkButton ID="lnkbtnLast" runat="server">尾页</asp:LinkButton>
<asp:Button ID="Button1" runat="server" Text="Go" />
</FooterTemplate>
<ItemTemplate>
<table class="style1">
<tr>
<td>
<!--<asp:Image ID="Image1" runat="server" ImageUrl =<%#DataBinder.Eval(Container.DataItem,"iamgeurl")%>/>-->
<img src='images/<%#DataBinder.Eval(Container.DataItem,"imageurl")%>'/>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>
后台
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class datalist分页 : System.Web.UI.Page
{
protected static PagedDataSource pds = new PagedDataSource();//创建一个分页数据源的对象且一定要声明为静态
protected void Page_Load(object sender, EventArgs e)
{
}
private void BindDataList(int currentpage)
{
pds.AllowPaging = true;
pds.PageSize = 3;
pds.CurrentPageIndex = currentpage;
string connStr = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);