日期:2014-05-18 浏览次数:20568 次
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//绑定到dropdownlist
SqlDataReader ds = BLLGroup.SelectGroup();
eTim
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//绑定到dropdownlist
SqlDataReader ds = BLLGroup.SelectGroup();
this.DropDownList1.DataSource = ds;
this.DropDownList1.DataTextField = "GroupName";
this.DropDownList1.DataValueField = "GroupID";
this.DropDownList1.DataBind();
ds.Close();
BindToGV();//绑定到gridview的方法
}
}
------解决方案--------------------
dropdownlist的selectindexchange事件中加上BindToGV();//绑定到gridview的方法
------解决方案--------------------
1.把BindToGV也放在ISPOSTBACK里面
2.设置dropdownlist的autopostback=true
3.在dropdownlist的selectindexchange事件里重新执行BindToGV
------解决方案--------------------
1楼正解,正确理解IsPostBack的意思,问题就很好解决了
------解决方案--------------------
up一楼!是数据的显示顺序问题,