在做一个网页的时候,出去版面的问题,必须要用到DATALIST
datagrid版面太死了,但是datalist又没有分页功能,希望有人指点
最好是提供一个控件,有VB.NET说明其接口或者相信的用法
datagrid版面太死了,但是datalist又没有分页功能,希望有人指点
最好是提供一个控件,有VB.NET说明其接口或者相信的用法
解决方案 »
- 如何设计网页才容易被搜索引擎搜索到?
- 怎样序列化用户控件(vs2005中)?--在线等待
- 新手的问题,通常比较简单,要赚分的来啦
- 为什么这句出错为“无法将类型“string”隐式转换为“bool” ”if (ds.Tables["tbl_Dt"].Rows[i][3].ToString() = "ABC")
- 请问怎样将EXCEL中的B5,F9..的值抓出来.(在线等)
- 如何动态改变页面标题?
- 关于子页面向父页面传值的问题;
- asp.net (vb) 代码 这个是错误的,请问正确的怎么写啊
- 难道非要让ASP.NET的控件累死!
- 怎么用ASP.net实现类似现在PHP论坛中分页效果
- 100分! 求一个调用客户端脚本的方法
- 谁有编辑图像和文本的控件?
<asp:label id="lblRecordCount" runat="server" ForeColor="red"></asp:label>條記錄
當前為
<asp:label id="lblCurrentPage" runat="server" ForeColor="red"></asp:label>/
<asp:label id="lblPageCount" runat="server" ForeColor="red"></asp:label>頁
<asp:HyperLink id="lnkPrev" runat="server">上一頁</asp:HyperLink>
<asp:HyperLink id="lnkNext" runat="server">下一頁</asp:HyperLink>
-------------------------------------------------------------------------------
public void BindGrid()
{
// 在此处放置用户代码以初始化页面
if(!Page.IsPostBack)
{
int BID,SID;
if ((Request.QueryString["BID"]==null)||(Request.QueryString["SID"]==null))
{
BID=1;
SID=200;
}
else
{
BID=System.Convert.ToInt32(Request.QueryString["BID"]);
SID=System.Convert.ToInt32(Request.QueryString["SID"]);
} PageSize=System.Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["MainList"]);
CurrentPage = 0;
//计算总共有多少记录
string str1,str2;
str1="SELECT COUNT(*) as co from pur where P_ID<>'' ";
str2="select *,pono as pono2 from pur where P_ID<>'' ";
int RecordCount = DBOperate.CalculateQRecord(BID, SID,str1);
lblRecordCount.Text = RecordCount.ToString();
//计算总共有多少页
PageCount = (RecordCount+PageSize-1)/PageSize;
if (PageCount<=0)
PageCount=1;
lblPageCount.Text = PageCount.ToString();
//获取页面参数
if (Request.QueryString["Page"] != null)
CurrentPage=Convert.ToInt32(Request.QueryString["Page"]);
else
CurrentPage=1;
if (PageCount<CurrentPage)
CurrentPage=PageCount;
if (CurrentPage<=0)
CurrentPage=1; //ListBind();
//设定导入的起终地址
int StartIndex = (CurrentPage-1)*PageSize;
string tablestr="pur";
//this.DL_Main.DataSource= DBOperate.SelectFormForum(str2,StartIndex,PageSize,tablestr);
DataTable dt=DBOperate.SelectFormForum(str2,StartIndex,PageSize,tablestr);
this.DL_Main.DataSource=dt;
this.Page.DataBind();
lnkNext.Enabled = true;
lnkPrev.Enabled = true;
if(CurrentPage==(PageCount))
{
lnkNext.Enabled = false;
}
else
lnkNext.NavigateUrl=Request.CurrentExecutionFilePath+ "?BID="+ BID.ToString()+"&SID="+ SID.ToString()+"&Page="+Convert.ToString(CurrentPage+1);
if(CurrentPage==1)
lnkPrev.Enabled = false;
else
lnkPrev.NavigateUrl=Request.CurrentExecutionFilePath + "?BID="+ BID.ToString()+"&SID="+ SID.ToString()+"&Page="+Convert.ToString(CurrentPage-1);
lblCurrentPage.Text = CurrentPage.ToString(); }
}