Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Components & Controls
Listviews / Treeviews
how to update selected checkbox in listview and update it into database
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="jmcilhinney, post: 167093, member: 641"] If you're working with data from a database then I would question why you're using a ListView rather than a DataGridView in the first place. If you're not using multiple views or grouping in the ListView then it's an inferior choice. That said, if you're determined to use a ListView then I would suggest that you populate a DataTable from the database and then assign each DataRow to the Tag property of the corresponding ListViewItem. That way you maintain a relationship between the two via more than just index. As always, if you want to do something with items that are checked then you loop through the CheckedItems collection. Checked is different to selected, so CheckedItems is different to SelectedItems. If you've taken my advice from the previous paragraph then you can access the corresponding DataRow via the Tag property of each checked item. Once the DataRows have been updated, you save the changes back to the database with a data adapter, just as you always do. [/QUOTE]
Insert quotes…
Verification
Post reply
Components & Controls
Listviews / Treeviews
how to update selected checkbox in listview and update it into database
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom