Removing all items from a list view

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • truezplaya
    New Member
    • Jul 2007
    • 115

    Removing all items from a list view

    hi

    Another niggling issule. I am trying to remove all the databound items from my listview but it doesn't work. I am trying to remove the items as i have used the delete command button (alongside with the updateand edit)

    I have tried.

    Code:
    listview1.items.clear();
    Code:
    listview1.datasource = null;
    listview1.databind();
    But none of these have worked. I have also tried removing the item via it's index.

    Could anybody point me in the direction of any other solutions or maybe even justify a possbility of why it isn't clearing. :( things never work how i expect in asp.net

    All answers are appreciated

    Truez
  • sanjib65
    New Member
    • Nov 2009
    • 102

    #2
    It's not clearing because it's databind(that you also know :)). Have you tried the Remove Items method?

    Comment

    • truezplaya
      New Member
      • Jul 2007
      • 115

      #3
      This also fails, I know its a databind but surely the databind on the null dataset would have refreshed this. The item is being removed from the DB but not from the screen. It's sooo annoying.

      Comment

      • sanjib65
        New Member
        • Nov 2009
        • 102

        #4
        When you refresh the page, what happens?

        Comment

        • truezplaya
          New Member
          • Jul 2007
          • 115

          #5
          me being silly i am afraid. The answer my very first post but i should have been clearing my local sets of data , Slightly embarassing. Sorry

          Comment

          • sanjib65
            New Member
            • Nov 2009
            • 102

            #6
            After reading your post I myself tested a new website with ListView and databind it with a local database. In fact I had to be careful about those SELECT, INSERT, DELETE queries and you know a tiny dot can mess things up.
            And it runs pretty well. And I just did not have to use Clear() or Remove() methods at all. The application deletes data fantastically without keeping anything in TextBoxes. DELETE button works perfectly.
            Did you find why it happened? In real world, if the queries are Okay, this should not have happened.
            Best of luck.

            Comment

            Working...