title: How to remove selected row in a gridview from a Session in VB.NET?
body: <p>Hi guys I am trying to make a webpage that has a list of items on 1 page which is displayed in a gridview that has the auto generate selected button enabled, they can click this button and it loads the item into a collection which i have stored in a session. On another page the session containing the items they selected gets displayed in a gridview. </p>
  
  <p>Now I want to be able for them to click the auto generated delete button so it will remove the item they want to remove from the gridview?? this is where im having trouble and need some one to help me out. </p>
  
  <p>I have a function in my index page(page that shows the available products) this is the code for it</p>
  
  <pre><code> Public Function addToCollection() As Collection
      If Session("Order") Is Nothing Then
          colOrder = New Collection
          Session("Order") = colOrder
      Else
          colOrder = Session("Order")
      End If
      Return colOrder
  End Function
  </code></pre>
  
  <p>I then have in the Page load my code to make the collection which is as follows :</p>
  
  <pre><code>         addToCollection()
      Dim gvRow As GridViewRow = gvCDs.SelectedRow
      Dim objOrder As Order = New Order
      objOrder.ID = gvRow.Cells(1).Text
      objOrder.Title = gvRow.Cells(2).Text
      objOrder.Artist = gvRow.Cells(3).Text
      objOrder.Price = gvRow.Cells(5).Text
      colOrder.Add(objOrder)
  
      Session("Order") = colOrder
  </code></pre>
  
  <p>then in my other page I display the session in the gridview as follows:</p>
  
  <pre><code>     Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
  
      gvOrder.DataSource = Session("Order")
      gvOrder.DataBind()
  
  End Sub
  </code></pre>
  
  <p>the gridview has the auto generated delete button next to each row and I want it so that when the button is clicked it removes the item from the gridview. Im not sure how to go about this but I do know I need to have it in the gvOrder_DeletedRow sub and that I need to just remove the item from the session then reload the page, Please help me solve this im not sure what code to write </p>