This is a migrated thread and some comments may be shown as answers.

pass at all pages

1 Answer 12 Views
Grid
This is a migrated thread and some comments may be shown as answers.
nissim
Top achievements
Rank 1
nissim asked on 30 Jul 2012, 11:45 AM

 

 

 

I have a grid with many pages (allowpaging = true) and I want onprerender

 

that some items will be selected = true

I have this code :

protected void Grid_MailingList_PreRender(object sender, EventArgs e)

    {

      foreach (GridDataItem item in Grid_MailingList.Items)

                {

                 string person = SessionMng.MessagesListData.Tables[0].Rows[i++]["iPersonId"].ToString();

                    DataView dv = new DataView(SessionMng.SavedMessage.Tables[1], "iPersonId= '" + person + "'", "", DataViewRowState.CurrentRows);

                    if (dv.ToTable().Rows.Count > 0)

                        item.Selected = true;

                }

            }

        }

    }

 

but it work only in the first page of the grid.

how can I pass on all of the pages at the grid ?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Jul 2012, 11:59 AM
Hi,

When paging is enabled in the grid, a solution would be to temporarily disable paging, loop through all the items in the grid, and then enable paging back.

C#:
Grid_MailingList.AllowPaging = false;
foreach (GridDataItem item in Grid_MailingList.Items)
{
 string person = SessionMng.MessagesListData.Tables[0].Rows[i++]["iPersonId"].ToString();
}
Grid_MailingList.AllowPaging = true;
Grid_MailingList.Rebind();

Thanks,
Princy.
Tags
Grid
Asked by
nissim
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or