Gridview Dynamic Pagesize

Discussion in 'ASP .Net Web Controls' started by icanhelp33@gmail.com, May 6, 2008.

  1. Guest

    I would like to assign dynamic pagesize to a gridview called
    gridCustomer. The customer data is a List with a column called
    groupId . When a new groupid is encountered I would like to display
    data in a new page. The code doesn't seem to work. Can you please
    help.

    gridCustomer.DataSource = customer;
    int groupId,groupRowId,count;

    groupId = 1;
    for (int i = 0; i < gridCustomer.Rows.Count; i++)
    {
    GridViewRow row = gridCustomer.Rows;
    Label lblGroupId =
    (Label)row.FindControl("GroupId");
    groupRowId = Convert.ToInt32(lblGroupId.Text);

    if (groupId == groupRowId)
    {
    count = count + 1;
    }
    else
    {
    gridCustomer.PageSize = count;
    count = 0;
    groupId = groupId + 1;
    }
    }
    gridCustomer.DataBind();
    , May 6, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adam Sandler

    Setting GridView PageSize at runtime

    Adam Sandler, May 16, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    10,406
    Adam Sandler
    May 16, 2006
  2. Dynamic DataGrid PageSize

    , Apr 17, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    359
  3. Vincent
    Replies:
    2
    Views:
    468
  4. Rod Billett

    Dynamic PageSize based on Browser body.clientHeight

    Rod Billett, Oct 23, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    207
    Rod Billett
    Oct 23, 2003
  5. Girish Prabhu

    Dynamic height and pagesize adjustment of Grid

    Girish Prabhu, Jan 27, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    118
    Girish Prabhu
    Jan 27, 2004
Loading...

Share This Page