aspnetpager控件的绑定
来源:互联网 发布:淘宝欧米茄碟飞翻新表 编辑:程序博客网 时间:2024/05/17 06:07
public partial class DisciplineTeamInfo : System.Web.UI.Page
{
DAL.DisciplineTeamInfo da = new DAL.DisciplineTeamInfo();
protected void Page_Init(object sender, EventArgs e)
{
DataSet ds = da.GetAll(); //得到全部数据
DataList1.DataSource = ds; //绑定datalist默认值
DataList1.DataBind();
this.AspNetPager1.PageSize = 10; //设置每也显示的记录条数
this.AspNetPager1.CurrentPageIndex = 1; //第一次显示的索引
}
protected void lbtn_del_Command(object sender, CommandEventArgs e)
{
M.DisciplineTeamInfo mod = new MODEL.DisciplineTeamInfo();
mod.TeacherNO = Convert.ToString(e.CommandArgument);
DAL.DisciplineTeamInfo da = new DAL.DisciplineTeamInfo();
da.delete(mod);
DataSet ds = da.GetAll();
DataList1.DataSource = ds;
DataList1.DataBind();
}
protected void btn_select_Click(object sender, EventArgs e)
{
string valu = txt_select.Text;
string fild = drp_lx.SelectedValue.ToString();
if (drp_lx.SelectedValue.ToString() == "quanbu")
{
//DataSet ds = da.GetAll();
//DataList1.DataSource = ds;
// DataList1.DataBind();
Bind();
}
else
{
// DataSet ds = da.GetAll(valu, "selid", fild);
// DataList1.DataSource = ds;
// DataList1.DataBind();
Session["bz"] = 2;
Bind();
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) //回发事件,只执行一次
{
Session["bz"] = 1;
if (Convert.ToInt32(Session["bz"]) == 1)
{
AspNetPager1.RecordCount = da.count(); //控件的总记录数
Bind();
}
}
}
private void Bind()
{
PagedDataSource pds = new PagedDataSource(); //控件的数据源
pds.AllowPaging = true; //是否小于两页还显示控件,true为一直显示
pds.PageSize = AspNetPager1.PageSize; //每页的记录数
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
if (Convert.ToInt32(Session["bz"]) == 1)
{
pds.DataSource = da.GetAll().Tables[0].DefaultView;
DataList1.DataSource = pds;
DataList1.DataBind();
}
else
{
string valu = txt_select.Text;
string fild = drp_lx.SelectedValue.ToString();
pds.DataSource = da.GetAll(valu, "selid", fild).Tables[0].DefaultView;
AspNetPager1.RecordCount = da.count(valu, "count1", fild);
DataList1.DataSource = pds;
DataList1.DataBind();
}
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
Bind();
}
}
- aspnetpager控件的绑定
- AspNetPager控件的使用方法
- AspNetPager控件的使用
- Aspnetpager控件的使用
- AspNetPager控件的使用方法
- AspNetPager控件的用法
- AspNetPager控件的用法
- aspnetpager的简单绑定使用。。
- AspNetPager分页控件的使用
- AspNetPager分页控件的使用
- AspnetPager分页控件的使用
- AspNetPager分页控件的使用
- AspNetPager分页控件的使用
- AspNetPager分页控件的使用
- AspNetPager分页控件的使用
- AspNetPager分页控件的使用
- AspNetPager分页控件的使用
- AspNetPager分页控件的使用
- js判断变量是否未定义
- 下拉列表等控件默认值的设置
- codeforces #149 div 2
- jsp存储textarea到数据中换行问题
- State_hundle
- aspnetpager控件的绑定
- [数据结构]线性结构——线性表
- 信号量,互斥锁和条件变量之间的差异
- Mysql 客户端
- 学习笔记5(CATransform3D-Cube)
- Windows Server 2012 Hyper-V新特性(1)
- Ad Hoc是什么?
- 杂记之C语言之auto与static,const
- Windows Server 2012 Hyper-V新特性(2)