Git Product home page Git Product logo

structuremap.webforms's People

Contributors

jwatney avatar

Watchers

 avatar  avatar  avatar

structuremap.webforms's Issues

AspNetControlLifecyclePolicy

Hi,
thanks for sharing your implementation, great :).
While integrating this in our good old Web Forms stuff i am facing a problem.
I assume is has to do with the AspNetControlLifecyclePolicy

  public class AspNetControlLifecyclePolicy : IInstancePolicy {
    public void Apply(Type pluginType, Instance instance) {
      /*
       * The lifecycle for each control should always be unique. The default
       * namespace for pages and user controls compiled by the ASP.NET
       * runtime is 'ASP'.
       */

      if((instance.ReturnedType.Namespace ?? "").StartsWith("ASP")) {
        instance.SetLifecycleTo(new UniquePerRequestLifecycle());
      }
    }
}

What was the motivation for the "StartsWith("ASP")"?
If I just want to enable the lifecycle for controls, how about this:

 if (typeof(Control).IsAssignableFrom(instance.ReturnedType))
                instance.SetLifecycleTo((ILifecycle) new UniquePerRequestLifecycle());

This would work for me.
Background is an exception in an ascx (I do not want to harass you with that) at Render-stage, with happens at an <%= %> tag. Without the <%= %> tags there is no exception.
`Error Message: Specified argument was out of the range of valid values.
Parameter name: index
Error Source: System.Web
Exception Stack Trace:
at System.Web.UI.ControlCollection.get_Item(Int32 index)
at ASP.formulare_formulareshopintern_edit_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
Best Regards,
Klaus

Unable to find control id <ControlID> referenced by 'ControlToValidate'

When I implement this solution on a ASP.NET WebForms page that has a required field validator, I am receiving a runtime error that says the runtime is unable to find a control id that is used by the required field validator attribute ControlToValidate.

When I remove this solution (by commenting it out in the Global.asax code behind) this error goes away. Any ideas why this is occurring and what can be done to resolve it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.