protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
btn_del.Attributes.Add("onclick", "return btnDele_Click();");
}
DataTable table = DataBase.GetAllColl();//获取数据源
DropDL.DataSource = table;
DropDL.DataTextField = "CollName";
DropDL.DataValueField = "CollID";
DropDL.DataBind(); }
private void Bind()
{
DataTable table3 = DataBase.GetStuColl(DropDL.SelectedValue );
pager.RecordCount = table3.Rows.Count;//分页控件数据源
PagedDataSource pg = new PagedDataSource();
pg.DataSource = table3.DefaultView;
pg.AllowPaging = true;
pg.PageSize = pager.PageSize;
pg.CurrentPageIndex = pager.CurrentPageIndex - 1;
gv_alllink.DataSource = pg;//将值传给GRIDEVIEW:gv_alllink
gv_alllink.DataBind();
pager.CustomInfoHTML = "共" + pager.RecordCount + "条 第" + pager.CurrentPageIndex + "页/共" + pager.PageCount + "页";
}
其中页面上显示的值始终是dropdownlist里的第一项的值,我读出selectvalue的值一看全是一,急请大家帮忙啊
{
if (!IsPostBack)
{
Bind();
btn_del.Attributes.Add("onclick", "return btnDele_Click();");
}
DataTable table = DataBase.GetAllColl();//获取数据源
DropDL.DataSource = table;
DropDL.DataTextField = "CollName";
DropDL.DataValueField = "CollID";
DropDL.DataBind(); }
private void Bind()
{
DataTable table3 = DataBase.GetStuColl(DropDL.SelectedValue );
pager.RecordCount = table3.Rows.Count;//分页控件数据源
PagedDataSource pg = new PagedDataSource();
pg.DataSource = table3.DefaultView;
pg.AllowPaging = true;
pg.PageSize = pager.PageSize;
pg.CurrentPageIndex = pager.CurrentPageIndex - 1;
gv_alllink.DataSource = pg;//将值传给GRIDEVIEW:gv_alllink
gv_alllink.DataBind();
pager.CustomInfoHTML = "共" + pager.RecordCount + "条 第" + pager.CurrentPageIndex + "页/共" + pager.PageCount + "页";
}
其中页面上显示的值始终是dropdownlist里的第一项的值,我读出selectvalue的值一看全是一,急请大家帮忙啊
{
DataTable table = DataBase.GetAllColl();//获取数据源
DropDL.DataSource = table;
DropDL.DataTextField = "CollName";
DropDL.DataValueField = "CollID";
DropDL.DataBind();
Bind();
btn_del.Attributes.Add("onclick", "return btnDele_Click();");
}