473,385 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Removing all items from a list view

115 100+
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.

Expand|Select|Wrap|Line Numbers
  1. listview1.items.clear();
  2.  
Expand|Select|Wrap|Line Numbers
  1. listview1.datasource = null;
  2. listview1.databind();
  3.  
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
Jan 23 '10 #1
5 2771
sanjib65
102 100+
It's not clearing because it's databind(that you also know :)). Have you tried the Remove Items method?
Jan 24 '10 #2
truezplaya
115 100+
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.
Jan 24 '10 #3
sanjib65
102 100+
When you refresh the page, what happens?
Jan 24 '10 #4
truezplaya
115 100+
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
Jan 24 '10 #5
sanjib65
102 100+
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.
Jan 25 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: tommazzo | last post by:
I'm currently writing a photo album sotware in C#. I'm using a ListView component to diaplay thumbnail previews of the photos and want to give the user the possibility to rearrange the photos via a...
2
by: VR | last post by:
I have a form with a list view control, a button control and a main menu with menuDelete item. Any time I am handling a button click event or menuDelete click event I call DeleteItem() function...
3
by: Jeremy Owens-Boggs | last post by:
We are trying to implement a dual list box selection where you have two list boxes, You highlight items in the right side list box, click a button and this moves those items over to the left hand...
11
by: Robin Tucker | last post by:
SelectedItems and SelectedIndices appear to be read-only, so I cannot remove a selected item. I need to do this to synchronise the selection in my list with the selection in other views (ie....
0
by: Brian Henry | last post by:
Since no one else knew how to do this I sat here all morning experimenting with this and this is what I came up with... Its an example of how to get a list of items back from a virtual mode list...
3
by: Brian Henry | last post by:
So what is the easiest way to do this? I have one list view with a list of items (in detail view and with about 20 sub items) and a second list view that will take the items they drag from the...
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
3
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
I've a multiview with 3 views. on view 2 the user is presented with a check box list (items from database) at view 3 the user can review their selections and, either post to the database or go back...
7
by: =?Utf-8?B?Sm9lbCBNZXJr?= | last post by:
I have created a custom class with both value type members and reference type members. I then have another custom class which inherits from a generic list of my first class. This custom listneeds...
1
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, In my application I need to periodically remove all current items from a ListView and add a new set into it. The following abbreviated code contains the basic idea: private void...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.