teemukeiski.net

Teemu Keiski's .NET site
Welcome to teemukeiski.net Sign in | Join | Help
in
Home Our Blogs BlogRoll Forums Photos Downloads

Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview

Last post 07-10-2007, 18:51 by joteke. 1 replies.
Sort Posts: Previous Next
  •  05-06-2007, 7:21 152

    Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview

    Hi,

    I'm removing rows from a gridview using Table.Remove( ). This removes the
    rows from the gridview.
    But the problem is although it removes rows from the gridview it doesnt
    update the Gridview.Rows.Count to return correct number of rows remains on
    the gridview. Instead it always returns the number of rows gridview
    originally had prior to removing them.

    Anybody know why this is happening? How to remove gridview rows in a manner
    so that it will update the rows.count property correctly?

    Note: I'm looking for a method to directly remove rows from a gridview
    without having to rebinding gridview to datasource controls etc...

    Dev
  •  07-10-2007, 18:51 159 in reply to 152

    Re: Strange Problem: Removing rows from Table object doesnt update rowcount of Gridview

    Hi,

    issue is that basically GridView.Rows is separate collection having separate GridViewRow objects (reference to them) which is created at the point the collection is instantiated. I think you should aim for a bit another kind of solution.


    Thanks,

    Teemu Keiski
    AspInsider, ASP.NET MVP
View as RSS news feed in XML