Gridview Dynamic Pagesize

I

icanhelp33

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();
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top