[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Remove an item from Listview

I have a listview populated by session state
session("test")
I would like to remove a row from  listview and datatable. thanks
0
zachvaldez
Asked:
zachvaldez
  • 5
  • 3
2 Solutions
 
CodeCruiserCommented:
Based on what condition? Is Session("test") a datatable?
0
 
zachvaldezAuthor Commented:
yes
0
 
CodeCruiserCommented:
What is the condition to remove the item?

Dim dt As DataTable = Session("test")
dt.Rows(0).Delete()

Listview1.DataSource = dt
Listview1.DataBind()
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
zachvaldezAuthor Commented:
<td>
                        <asp:LinkButton ID="EditButton" runat="Server" Text="Edit" CommandName="Edit" />
                    </td>
                    <td>
                        <asp:LinkButton ID="LinkButton1" runat="Server" Text="Delete" CommandName="Delete" />
                    </td>

I think the code has to go to the Listview1_itemcommand

also Datakeys = "rowID"

I
0
 
zachvaldezAuthor Commented:
Hi ,
It deletes but cannot find the index or the row...
This..dt.Rows(0).Delete()
only deletes the first item which has the index(0) but not the row that is selected.

thanks
0
 
zachvaldezAuthor Commented:
I found the answer to get the index..

dt.Rows(e.Item.DataItemIndex).Delete()>>>gets to the point

BTW how does Edit work?
Should I be able to edit in place in the listview or assign the values in the form?
I put additional points here

Thanks
0
 
zachvaldezAuthor Commented:
Great! Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now