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 4256918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:25:12+00:00 2026-05-21T05:25:12+00:00

I have a GridView and on a row being deleted I trigger the GridView1_RowDeleting

  • 0

I have a GridView and on a row being deleted I trigger the GridView1_RowDeleting sub, but I receive an error “LINQ to Entities does not recognize the method ‘System.Web.UI.WebControls.TableCell get_Item(Int32)’ method, and this method cannot be translated into a store expression.” Code is:

Private Sub GridView1_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
    ' The deletion of the individual row is automatically handled by the GridView.
    Dim dbDelete As New pbu_housingEntities
    ' Remove individual from the bed.
    Dim remove_bed = From p In dbDelete.Beds _
                     Where p.occupant = GridView1.Rows(e.RowIndex).Cells(3).Text _
                     Where p.room = GridView1.Rows(e.RowIndex).Cells(6).Text _
                     Where p.building = GridView1.Rows(e.RowIndex).Cells(5).Text _
                     Order By p.id Descending _
                     Select p

    remove_bed.First.occupant = ""
    dbDelete.SaveChanges()

    ' Increase number of open spaces in room.
    Dim update_occupancy = From p In dbDelete.Rooms _
                           Where p.room1 = GridView1.Rows(e.RowIndex).Cells(6).Text
                           Where p.building = GridView1.Rows(e.RowIndex).Cells(5).Text _
                           Select p

    update_occupancy.First.current_occupancy = update_occupancy.First.current_occupancy - 1
    dbDelete.SaveChanges()

End Sub

The specific line erroring out is:

remove_bed.First.occupant = ""
  • 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-05-21T05:25:13+00:00Added an answer on May 21, 2026 at 5:25 am

    That’s because the Linq query is translated to SQL, and there is no way to translate GridView1.Rows(e.RowIndex).Cells(3).Text to SQL. You need to extract the values from the GridView, then use them in the query

    Dim occupant As String = GridView1.Rows(e.RowIndex).Cells(3).Text
    Dim room As String = GridView1.Rows(e.RowIndex).Cells(6).Text
    Dim building As String = GridView1.Rows(e.RowIndex).Cells(5).Text
    Dim remove_bed = From p In dbDelete.Beds _
                     Where p.occupant = occupant _
                     Where p.room = room _
                     Where p.building = building _
                     Order By p.id Descending _
                     Select p
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have GridView which I can select a row. I then have a button
i have a databound GridView in asp.net 2.0 with a row-selection link. When a
I have a GridView with a row number (Container.DataItemIndex) column in ASP.NET (1,2,3,4, ...)
I have implement GridView Row Editing feature in my .net application using <asp:CommandField .
I have come across odd behavior involving nested gridview controls and row events. Basically
I have a GridView control in an Asp.net application, that has a <asp:buttonField> of
I have a GridView where one column is bound to an object property containing
I have a GridView defined like this: <asp:GridView ID=myGridView ruant=server> <asp:BoundField DataField=myField /> <asp:CommandField
I have a gridview like below: <asp:GridView DataKeyNames=TransactionID AllowSorting=True AllowPaging=TrueID=grvBrokerage runat=server AutoGenerateColumns=False CssClass=datatable Width=100%
I have a GridView that I would like to bind to an ObjectDataSource. I

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.