上边是一个DataGrid下边用一个dropdownlist作页面转向功能。。
dropdownlist自动绑定页面的页码。。通过选择页码实现页面的转向??请问如何实现??

解决方案 »

  1.   

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {        GridView1.PageIndex = Convert.ToInt32(DropDownList1.SelectedValue);
        }
      

  2.   

    DropDownList还没有和页数进行绑定???
    关键是这里怎么搞
      

  3.   

    在页面的名称填充到DropDownList1的前提下:protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {        Response.Redirect ("DropDownList1.SelectedValue");
        }
      

  4.   

    已经解决了
    原来有这样一个功能。我只知道绑定数据库。。不会绑定这个

    for(int   i=0;i<Convert.ToInt32(this.DataGrid1.PageCount);i++)   
    {   
    ListItem   it   =   new   ListItem();   
    it.Text= (i+1).ToString();   
    it.Value=i.ToString();   
    DropDownList1.Items.Add(it);   
    }
      

  5.   

    1.你要实现的功能,完全可以由免费的分页控件可以实现,网上有不少这样的控件,下载一个用就是了2.自己实现你所说的功能
    DropDownList还没有和页数进行绑定???
    关键是这里怎么搞查询数据库获取总的数据记录数量,然后除以每页记录数量,接着取整就可以得到页码数量
      

  6.   

    private void BindingList()
        {        for (int i = 1; i <= GridView1.PageCount; i++)
                {
                    DropDownList1.Items.Add(new ListItem(string.Format("第{0}页", i), i.ToString()));
                }
            
        }
      

  7.   

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindingList();     
            }
            
        }你不会一个贴一直问问题吧?
      

  8.   

    没办法。。新手。。
    好多不懂。。做毕业设计啊。。DropDownList1_SelectedIndexChanged()选择了怎么无法跳转。。
    用的是这种方法
    this.DataGrid1.CurrentPageIndex=this.DropDownList1.SelectedIndex;
    Bind();
      

  9.   

    AutoPostBack忘记设置了。。大意了。。