gv,Repeater分页示例代码

   web:

  if (!IsPostBack)
                this.GridView1.Sort("ID", SortDirection.Ascending);

 

BLL

 

DAL

 <add name="WS2ConnString" connectionString="Data Source=./SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|Warehouse2.mdf" providerName="System.Data.SqlClient"/>

 

 

 

   <asp:GridView ID="gvTraderFavourable" runat="server" AutoGenerateColumns="False"
                DataKeyNames="TraderFavourableInfoID" AllowSorting="true" OnRowCommand="gvTraderFavourable_RowCommand"
                OnSorting="gvTraderFavourable_Sorting">

<asp:HiddenField ID="HidSortDirection" Value="DESC" runat="server" />
    <asp:HiddenField ID="HidSortExpression" Value="TraderFavourableInfoID" runat="server" />

 

 

 

 

Repeater 内嵌Repeater/datalist

 int cityID = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "CityID").ToString());

 

  protected void rptHotel_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            HiddenField hidHotelID = e.Item.FindControl("hidHotelID") as HiddenField;
            Repeater rptGuestRoom = e.Item.FindControl("rptGuestRoom") as Repeater;//找到里层的repeater对象

            rptGuestRoom.DataSource = ds;
            rptGuestRoom.DataBind();

}

}

 


 if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)  
     {  


  Repeater   rep=(Repeater)e.Item.FindControl("Repeater_VODMovies");  
  int   cid=int.Parse((Datalist_VODCategory.DataKeys[e.Item.ItemIndex]).ToString());  
  DataView   view=table;  
  view.RowFilter="SubCategoryID='"+cid+"'";  
  rep.DataSource=view;  
  rep.DataBind();  

}

 

 

 


Repeater
foreach (Control c in this.rptEstablishment.Controls)
        {
            CheckBox chkEstablishmentAll = c.FindControl("chkEstablishmentAll") as CheckBox;
            if (chkEstablishmentAll != null)
            {
                if (chkEstablishmentAll.Checked)//不限不选中时
                {
                    hotelEstablishment = "";
                    break;
                }
            }

        }

HOW TO:使用嵌套 Repeater 控件和 Visual C# .Net 显示分层数据
http://support.microsoft.com/kb/306154/zh-cn?spid=1108&sid=global

 

 

 

 

子Repeater 取夫Repeater 的值

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值