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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:22:27+00:00 2026-05-12T06:22:27+00:00

I am using the new ADO.NET Entity Data Model on a simple database. I

  • 0

I am using the new ADO.NET Entity Data Model on a simple database. I have a table/entity with a primary key (PageID) and a ParentID foreign key that references back to itself on PageID for a parent/child “0..1 to many” relationship. On a ASP.Net page, I’m using a FormView with a asp:DynamicControl to express this as a control. That part works fine except for one crucial detail: When the page renders, the list of possible parents includes itself, and setting an item to have a parent of itself causes no errors and saves to the database. Obviously a hierarchical object isn’t supposed to have a parent of itself, so how do I restrict this behavior?

As far as I can see, my options are:

  • Somehow change the ForeignKey_edit.ascx in the DynamicData FieldTemplates. This is problematic because I can’t see how to get a reference to the current entity’s primary key to remove it from the possible foreign key choices. Plus, this will potentially hose any non-hierarchical fkey refs usages where the keys happen to collide.

  • Do some PreRender jiggery-pokery on the page to try to remove the ListItem from the rendered DropDownList. This doesn’t seem like the Right Way as it only fixes it for the page in question. EDIT: This is how I’m solving it currently.

  • Some sort of insert/update trigger to force the ParentID to null if it matches itself. This isn’t good because it fails silently from the user’s perspective.

Has anyone out there got a better way? Also, let me know if I need to provide any more detail.

-Kelly

  • 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-12T06:22:27+00:00Added an answer on May 12, 2026 at 6:22 am

    I ended up moving the hierarchy to an assembly table because I had to store more than just parent/child relationships. Doing so also meant I could dump the DynamicData control and use a more user-intuitive TreeView with drag-n-drop server-side events (ComponentArt). Because of the nature of the control, no item could be it’s own parent so the problem was moot. Wow, 7 months is a long time in my first experience with Entity Framework 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 200k
  • Answers 200k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is a very similar question to the one posted… May 12, 2026 at 7:55 pm
  • Editorial Team
    Editorial Team added an answer I would suggest using UDP rather than TCP with manual… May 12, 2026 at 7:55 pm
  • Editorial Team
    Editorial Team added an answer You should do a COMMIT every time you complete a… May 12, 2026 at 7:55 pm

Related Questions

I am working with a few legacy tables that have relationships, but those relationships
I have a field of type image in my database which is mapped as
I have followed this tutorial which allowed me to create a Silverlight DataGrid that
I am considering using ADO.Net Data Services in a project for the purpose of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.