hide/delete rows & the consequent page numbering problem


Thomas Kopp

Hi all;

This is my first time on here (followed the link on DataGridGirl's site). I'm fairly experienced, but this one has me about to pull my hair out, something I can ill afford.

I've bound a datasource to the grid. On the _ItemDataBound function, I'm determining, via a called function, whether this item should be displayed or not. That's okay, not a problem. I return a bool to the _ItemDataBoundfunction. I can hide the item (e.Item.Visible = false). However, that of course doesn't do anything else, so I have a variable number of items displayed on each page of the grid, with the number of pages remaining unchanged.

You may ask why I am trying to do it this way. If, before the datagrid.databind(), I delete the datarows from the datasource via code, the process takes approximately twenty seconds. If I use a stored procedure to alter the datasource before I bind it, the time is about the same (the sp has 628 lines of code). I can't use a view because the original datasource is recursively created. Hiding items on the grid is the closest I've gotten to a reasonable solution (I can of course disable yet show the items, which will make the paging consistent with the display, but this would pretty much defeat the original purpose of what I'm trying to do, which is to conveniently display only records that fit a certain criteria).

I've considered a couple strange and ugly methods which avoid any datatable/datasource manipulation (the deletion via code described above uses the same function as hiding the rows, but requires datatable operations). I've unsuccessfully tried substituting a DataRow array for the datatable that's the datasource hoping that would speed things up.

The problem at this point is as described above: the grid is not repaged after the hides I the nature of items in the datagrid, so I know there's no straightforward way to do this, if there is any way at all. I'm following up on the SQL angle, but so far with no luck.

Any help would be appreciated.

Thomas Kopp

Thomas Kopp
Distributed Programmer/Analyst
Bureau of Health Licensure and Regulation


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