Windows Phone Developers

Tuesday, February 17, 2009

How to delete all items from a ListView using C#

To remove all listview items use the clear method

For example:

listView1.Clear();

will empty the listview

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

1 comment:

  1. void BindData()
    {
    string[] Keys = new string[1];
    Keys[0] = "IDOWNLOADID";
    LvDownloads.DataKeyNames = Keys;
    LvDownloads.DataSource = ObjDownloadBL.GetDownloads();
    LvDownloads.DataBind();
    }


    protected void LvDownloads_ItemDeleting(object sender, ListViewDeleteEventArgs e)
    {

    //string DownloadId = int.Parse(e.CommandArgument.ToString());
    ObjDownloadCon.IDOWNLOADID = int.Parse(this.LvDownloads.DataKeys[e.ItemIndex].Value.ToString());
    ObjDownloadCon.sptype = "Delete";
    ObjDownloadBL.Tbl_Download_Save_Update(ObjDownloadCon);
    BindData();


    }

    ReplyDelete