Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8803291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:18:10+00:00 2026-06-14T01:18:10+00:00

I have a simple question which i am not able to solve myself. I

  • 0

I have a simple question which i am not able to solve myself.

I have an ObjectListView filled with some of my objects. But in addition to that I want to have another column, with a default text “Delete”. On clicking that column, the selected Row should be deleted. How do I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:18:11+00:00Added an answer on June 14, 2026 at 1:18 am

    You can achieve this by making the desired row editable and use the CellEditActivation event. Initialize your OLV and “delete-column” as follows:

    // fire cell edit event on single click
    objectListView1.CellEditActivation = ObjectListView.CellEditActivateMode.SingleClick;
    objectListView1.CellEditStarting += ObjectListView1OnCellEditStarting;
    
    // enable cell edit and always set cell text to "Delete"
    deleteColumn.IsEditable = true;
    deleteColumn.AspectGetter = delegate {
        return "Delete";
    };
    

    Then you can remove the row in the CellEditStarting handler as soon as the column is clicked:

    private void ObjectListView1OnCellEditStarting(object sender, CellEditEventArgs e) {
        // special cell edit handling for our delete-row
        if (e.Column == deleteColumn) {
            e.Cancel = true;        // we don't want to edit anything
            objectListView1.RemoveObject(e.RowObject); // remove object
        }
    }
    

    To improve on this, you can display an image in addition to the text.

    // assign an ImageList containing at least one image to SmallImageList
    objectListView1.SmallImageList = imageList1;
    
    // always display image from index 0 as default image for deleteColumn
    deleteColumn.ImageGetter = delegate {
        return 0;
    };
    

    Result:

    enter image description here

    If you don’t want to display any text next to the image you can use

    deleteColumn.AspectToStringConverter = delegate {
        return String.Empty;
    }; 
    

    You could also set the Aspect to an empty string, but consider this as “best practice”. By still returning an aspect, sorting and grouping will still work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A fairly simple question for which I have a guess, but I can't find
I have a question which I am sure is simple but I have slight
The question is simple. I have a string that contains multiple elements which are
I have what I thought was a simple question but havent been able to
I have a pretty simple question which perhaps someone familiar with Server/Client design &
I have a very simple question for which I can't seem to find an
Simple question which I can't seem to find an answer of: I have two
i have this simple question please. I have this part of code which sets
A simple question. I have an ASP.NET web application which contains several assemblies and
simple question... Given I have an ASP.NET site, which uses a [custom] RoleProvider, Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.