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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:39:50+00:00 2026-05-27T10:39:50+00:00

I have a simple Repeater Bound to a List of Objects, the object containing

  • 0

I have a simple Repeater Bound to a List of Objects, the object containing a series of strings for rendering.

The object is the following:

class BestPractice
    {
        public string Title { get; set; }
        public string Author { get; set; }
        public string Body { get; set; }
    }

rendered using the following code to make sure the loop wasn’t causing problems:

List<BestPractice> BestPractices = new List<BestPractice>();
foreach (SPListItem item in items)
                {
                    BestPractice bp = new BestPractice();
                    bp.Author = "test";//(string)item["Author"];
                    bp.Body = "test";// (string)item["Body"];
                    bp.Title = "test";// (string)item["Title"];
                    BestPractices.Add(bp);
                }

                BPRepeater.DataSource = BestPractices;
                BPRepeater.DataBind();

I’ve stepped through the code to make sure the List contained an item, and that that item had populated strings before being databound. The Exception happens here in the .g.cs file:

[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
        public void @__DataBind__control4(object sender, System.EventArgs e) {
            System.Web.UI.WebControls.RepeaterItem Container;
            System.Web.UI.DataBoundLiteralControl target;
            target = ((System.Web.UI.DataBoundLiteralControl)(sender));
            Container = ((System.Web.UI.WebControls.RepeaterItem)(target.BindingContainer));
            target.SetDataBoundString(0, System.Convert.ToString(DataBinder.Eval(Container.DataItem, "Author"), System.Globalization.CultureInfo.CurrentCulture));
        }

The following is the exception itself:

System.Reflection.TargetInvocationException was unhandled by user code
  Message=Property accessor 'Author' on object 'Carpool_Webparts.Offer_Details.BestPractice' threw the following exception:'Carpool_Webparts.Offer_Details.BestPractice.get_Author()'
  Source=System
  StackTrace:
       at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
       at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName)
       at System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts)
       at Carpool_Webparts.Offer_Details.Offer_Details.__DataBind__control4(Object sender, EventArgs e)
       at System.Web.UI.Control.OnDataBinding(EventArgs e)
       at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
       at System.Web.UI.Control.DataBindChildren()
  InnerException: System.MethodAccessException
       Message=Carpool_Webparts.Offer_Details.BestPractice.get_Author()
       Source=mscorlib
       StackTrace:
            at System.Reflection.MethodBase.PerformSecurityCheck(Object obj, RuntimeMethodHandle method, IntPtr parent, UInt32 invocationFlags)
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
            at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
       InnerException: System.Security.SecurityException
            Message=Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
            Source=mscorlib
            StackTrace:
                 at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
                 at System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
                 at System.Security.PermissionSetTriple.CheckSetDemand(PermissionSet demandSet, PermissionSet& alteredDemandset, RuntimeMethodHandle rmh)
                 at System.Security.PermissionListSet.CheckSetDemand(PermissionSet pset, RuntimeMethodHandle rmh)
                 at System.Security.PermissionListSet.DemandFlagsOrGrantSet(Int32 flags, PermissionSet grantSet)
                 at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant, CompressedStack securityContext)
                 at System.Security.CodeAccessSecurityEngine.ReflectionTargetDemandHelper(Int32 permission, PermissionSet targetGrant)
            InnerException: 

I am totally lost 🙁

  • 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-27T10:39:51+00:00Added an answer on May 27, 2026 at 10:39 am

    I am not 100% certain what the specific issue is, but based on the error message, I would suggest two possible changes:

    1) Verify that the BestPractice class is public (you can ratchet the exposure level back down once you verify it is or isn’t working).

    2) Change the auto-implemented properties to member-backed properties. The inner exception indicates there is a security exception on the get_Author accessor, which leads me to believe that the auto-implementation could have something to do with it.

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

Sidebar

Related Questions

I have the following repeater control, which is bound to collection of DashboardPage objects.
I have a Repeater bound from SQL, containing a mixture of editable and read-only
say we have simple asp.net repeater, in a row we have one checkbox, one
I have a page with a repeater and a button. (quite simple) My repeater
I have a fairly simple web application that gets a list of items from
I have an asp.net repeater control with a series of asp:hyperlink's <asp:HyperLink runat=server ID=name
I have a simple form: <form id=myForm method=post action=../SentinelOperationsUI/SystemAuditView.aspx class=formular> <fieldset> <legend> Buy-In </legend>
I have simple regex \.*\ for me its says select everything between and ,
I have simple win service, that executes few tasks periodically. How should I pass
i have simple regular expression: ^123$ Matches are for example 123 1234 etc. How

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.