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

  • SEARCH
  • Home
  • 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 6665035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:40:48+00:00 2026-05-26T02:40:48+00:00

can i set value for a property like this public string MyProperty { get

  • 0

can i set value for a property like this

public string MyProperty { get { return _GetValue(); } set { _GetValue(); } }


 public static string _GetValue()
    {
        string name = null;
        using (HROEF.Entities context = new HROEF.Entities())
        {
            var result = (from my linq Statement).First().ToString();
            name = result;
        }
        return name;
    }

In my View

@Html.DisplayFor(model=>Model.MyProperty)

is there any thing wrong in this?

It is not displaying the value in my view

any help?

  • 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-26T02:40:48+00:00Added an answer on May 26, 2026 at 2:40 am

    In general, you shouldn’t be doing database accessin properties. It’s just bad practice. Properties should not perform lengthy operations that can time out, or have other issues.

    As for why it’s not showing your value, that’s hard to say. Most likely, your linq query simply isn’t returning any results.

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

Sidebar

Related Questions

0 Project. I have property public string UserName { get; set; } can i
I have a class like this: public class Data { public string Name {
Assuming I have an attached property defined like that : public static string GetMyProperty(DependencyObject
The base class WebPart has a property defined like this: [WebBrowsable(true)] public virtual string
How can I get Environnment variables and if something is missing, set the value?
I'd like to do something like this: Private _myCollection As IList(Of T) Public Property
I'm used to writing classes like this: public class foo { private string mBar
I need a Guid property in some attribute class like this: public class SomeAttribute
I’ve got a class with a property that looks like this: [AllowHtml] [DataType(DataType.MultilineText)] public
I'm trying to return code like this (can be found here ): {hotspots: [{

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.