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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:05:53+00:00 2026-06-11T07:05:53+00:00

I have a table called Entries and am using LINQ to SQL for data

  • 0

I have a table called “Entries” and am using LINQ to SQL for data access. I have created a stored procedure that fetches all entries. I’ve mapped that stored proc to a method in my data context, I’ve set the return type to “Entry”.

I have created a method in my data access class that returns the results of this method call as List. I am binding the list to a repeater in a user control and attempting to access the property “EntryId” in my ascx file and am getting the following error:

‘object’ does not contain a definition for ‘EntryId’

My method in my DataAccess class:

public static List<Entry> GetAllEntries()
{
    using (DataClassesDataContext context = new DataClassesDataContext())
    {
        return context.fbGetAllEntries().ToList();
    }
}

And in the user controls Page_PreRender event:

//my alias at the top of the file for clairification
using ASPWebControls = System.Web.UI.WebControls;

protected void Page_PreRender(System.Object sender, System.EventArgs e)
{
   rptEntries = new ASPWebControls.Repeater();

   rptEntries.DataSource = DataAccess.GetAllEntries();

   rptEntries.DataBind();
}

And in my ascx file:

<asp:Repeater ID = "rptEntries" runat = "server" >
    <ItemTemplate>
        <tr>
            <td><input type="checkbox" runat="server"  value="<%# Container.DataItem.EntryId %>"  /></td>
        </tr>
    </ItemTemplate>
</asp:Repeater>

When I Googled this error I found it can happen when using anonymous types but that is not the case here. I am certain my repeater has a list of strongly typed objects bound to it. I’ve tried explicitally casting:

rptEntries.DataSource = (List<Entry>)DataAccess.GetAllEntries();

I am certain my Entry type has an EntryId as I can do this:

foreach (Entry en in (List<Entry>)rptEntries.DataSource)
{
   //when I step through I can see these are the correct values
   int i = en.EntryId;
}

I’ve tried importing my namespace in my ascx file:

<%@ Import NameSpace="Namespace.in.my.DataClass.cs" %> 

I’m not sure where things are going sideways, could anyone suggest what I am doing wrong? Any help would be appreciated, thanks!

Edit: missed a code block

  • 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-11T07:05:55+00:00Added an answer on June 11, 2026 at 7:05 am

    Even though the items are strongly-typed, the repeater control exposes them as object-types in the ItemTemplate. You need to unbox it explicitly:

    <%# ((Entry)Container.DataItem).EntryId %>
    

    Note that ASP.Net 4.5 has a strongly-typed repeater that allows you to specify an ItemType property and removes the need for the unboxing.

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

Sidebar

Related Questions

I have names stored in my mysql database i created a table called users
I have a table called tbl_jobs that stores the meta data of some background
I am using MySQL. I have a table called entries. This table has a
I have a table called 'MyTable' that looks like: ID | Item | Type
I have a table called TPM_TASKS which contain all tasks, as well as a
I have a table (lets say it has one column called 'colLanguage') that contains
I have a table in database called user which has following entries. Userid FirstName
I have the following query which groups all entries in a MySQL table by
I'm using Entity Framework 4.1 Code First and I have a table that has
I have a table called entries with an associated model called Entry . 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.