问题 如题
比如dropdownlist 选择10
则datagrid显示的条数为10 再分页
dropdownlist 选择为20
则datagrid显示的条数相应为20 再分页感觉不难 但没有思路 那位大虾曾经做过 还望赐教

解决方案 »

  1.   

    grid分页用传参数的方法(存储过程很多啊)
    分页大小就是dropdownlist选择的数字.改变选择促发事件里重新绑定就可以了
      

  2.   

    关于pagesize的属性 要通过dropdownlist来控制  很想知道阿!1
      

  3.   

    private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面 if(IsPostBack==true)
    {
    DataGrid1.PageSize=Convert.ToInt32(this.DropDownList1.SelectedItem.Text);
    }
    BindDataGrid();
    }

    void BindDataGrid() 
    {
    SqlConnection conPubs;
    SqlDataAdapter dadTitles;
    DataSet dstTitles; conPubs = new SqlConnection( @"Server=localhost;uid=sa;pwd=;Database=Pubs" );
    dadTitles = new SqlDataAdapter( "Select * From Titles Order By Title", conPubs );
    dstTitles = new DataSet();
    dadTitles.Fill( dstTitles ); DataGrid1.DataSource = dstTitles;
    DataGrid1.DataBind();

    }

    void dgrdTitles_PageIndexChanged( object s, DataGridPageChangedEventArgs e ) 
    {
    DataGrid1.CurrentPageIndex = e.NewPageIndex;
    BindDataGrid();
    }
      

  4.   

    可以用DropDownList的SelectedIndexChanged事件来实现,页面上该DropDownList的AutoPostBack属性要设置成true才能响应后台的SelectedIndexChanged事件哦
      

  5.   

    DataGrid1.PageSize=Convert.ToInt32(this.DropDownList1.SelectedItem.Text);
    对此很感兴趣 但不知道怎么触发 
    To y_dong119(woman is a dead circulation)
    这个应该在什么地方触发~~