当前位置:编程学习 > C#/ASP.NET >>

asp.net 分页怎么实现

帮忙 各位 大哥 我想在 网页 里 实现 图片 分页 显示  点击 图片 进入 仔细 介绍图片 以及相关信息    怎么 实现的 代码 以及 能 介绍 详细 更好  谢谢 大哥们了 --------------------编程问答--------------------    你的话  没搞懂  是不是需要分页呢 --------------------编程问答--------------------
  <div class="p_con">
   <ul>
       <asp:DataList ID="dllCase" RepeatColumns="4" RepeatDirection="Vertical" runat="server">
       <ItemTemplate>
           <li><a href='CaseDetail.aspx?id=<%#Eval("id") %>'><img src='UploadFiles/<%#Eval("pic") %>' width="156" height="130" alt='<%#Eval("name") %>' /></a><span><a href='CaseDetail.aspx?id=<%#Eval("id") %>'><%#Eval("name") %></a></span></li>

       </ItemTemplate>
       </asp:DataList>
    
   </ul>
       <div style="text-align: center; color: Red; font-size: 14px;" id="ms" runat="server"
                    visible="false">
                    没有相关信息</div>
   <div class="quotes">
    <webdiyer:AspNetPager ID="AspNetPager1" AlwaysShow="true" runat="server" CssClass="formfield" 
                CustomInfoClass="formbutton" 
                CustomInfoHTML="第<font color='red'><b>%CurrentPageIndex%</b></font>页 共%PageCount% 页 %StartRecordIndex%-%EndRecordIndex%" 
                CustomInfoTextAlign="Center" FirstPageText="首页" horizontalalign="Center" 
                InputBoxStyle="width:19px" LastPageText="尾页" meta:resourceKey="AspNetPager1" 
                NextPageText="下一页" onpagechanged="AspNetPager1_PageChanged" PrevPageText="前一页" 
                showcustominfosection="Left" ShowInputBox="Never" ShowNavigationToolTip="True" 
                style="FONT-SIZE: 14px" SubmitButtonClass="formfield" SubmitButtonText="GO" 
                width="506px" UrlPaging="True" PageSize="8">
            </webdiyer:AspNetPager>
   </div>
  </div>

 /// <summary>
    /// 绑定案例列表
    /// </summary>
    private void DisplayCaseList()
    {
        List<CasePro> list = CaseProManager.GetProByCbId(bid);
  
        if (list.Count == 0)
        {
            ms.Visible = true;
        }
        else
        {
            AspNetPager1.RecordCount = list.Count;
            PagedDataSource pds = new PagedDataSource();
            pds.DataSource = list;
            pds.AllowPaging = true;
            pds.PageSize = AspNetPager1.PageSize;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            dllCase.DataSource = pds;
            dllCase.DataBind();
        }
    }

 protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        DisplayCaseList();
    }

详细页


 <div class="p_more_con">
    <img src='UploadFiles/<%=pic %>' width="700" height="437" alt="杭州旗庭建筑装饰设计工程有限公司" />
    <div class="p_left">
     <ul>
      <li>方案名称:</li>
      <li>方案描述:</li>
     </ul>
    </div>
        <div class="p_right">
     <ul>
      <li><%=name %></li>
      <li><%=desc %></li>
      <li style=" margin-left:300px;">
      <img src="images/return.gif" onclick="history.go(-1)" style="cursor:hand" />
      </li>
     </ul>
    </div>
  </div>

 public string name;
    public string desc;
    public string pic;
    int id;
    public string Name;
    public string eng;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["id"] != null)
        {
            id = Convert.ToInt32(Request["id"]);
        }
        if (!IsPostBack)
        {
            DislayCaseDetail();//显示案例详细信息

        }
    }

    private void DislayCaseDetail()
    {
        CasePro cp = CaseProManager.GetCaseProInfo(id);
        name = cp.Name;
        desc = cp.Descript;
        pic = cp.Pic;
                }
--------------------编程问答--------------------  <a href="链接介绍图片的路径"><asp:Image ID="Image1" runat="server" ImageUrl="~/image/DSC_0006.JPG" ToolTip= "详细信息" /></a>
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,