Unable to generate code...

Discussion in 'ASP .Net' started by A Traveler, Oct 12, 2004.

  1. A Traveler

    A Traveler Guest

    Hello, i am having this problem. The exact error message is:

    "Unable to generate code for a value of type 'System.Web.UI.Page'. This
    error occurred while trying to generate the property value for Page."

    After a lot of googling, all i can find that this applies to is when trying
    to use enum-type datatypes as bit-vector flags, or when use designers to
    make an expandable property in the property tool-window. However, NEITHer of
    these cases apply to my page. This is only happening on one page in the
    project. But the stack trace of the error (included at the end) gives me no
    hint of where to even start looking to fix it, of WHAt exactly might be
    wrong with the page.

    Thanks in advance,
    - Arthur Dent.

    ===================================================

    <stackTrace>
    [HttpException (0x80004005): Unable to generate code for a value of type
    'System.Web.UI.Page'. This error occurred while trying to generate the
    property value for Page.]
    System.Web.Compilation.CodeDomUtility.GenerateExpressionForValue(PropertyInfo
    propertyInfo, Object value, Type valueType) +2369
    System.Web.Compilation.TemplateControlCompiler.BuildBuildMethod(ControlBuilder
    builder, Boolean fTemplate, PropertySetterEntry pse) +2545
    System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    builder, Boolean fInTemplate, PropertySetterEntry pse) +794
    System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    builder, Boolean fInTemplate, PropertySetterEntry pse) +352
    System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    builder, Boolean fInTemplate, PropertySetterEntry pse) +352
    System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    builder, Boolean fInTemplate, PropertySetterEntry pse) +352
    System.Web.Compilation.TemplateControlCompiler.BuildMiscClassMembers()
    +51
    System.Web.Compilation.PageCompiler.BuildMiscClassMembers() +9
    System.Web.Compilation.BaseCompiler.BuildSourceDataTree() +1279
    System.Web.Compilation.BaseCompiler.GetCompiledType() +129
    System.Web.UI.PageParser.CompileIntoType() +59
    System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() +126

    [HttpException (0x80004005): Unable to generate code for a value of type
    'System.Web.UI.Page'. This error occurred while trying to generate the
    property value for Page.]
    System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
    fCreateIfNotFound) +692
    System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() +125
    System.Web.UI.TemplateParser.GetParserCacheItem() +88
    System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String
    virtualPath, String inputFile, HttpContext context) +116
    System.Web.UI.TemplateControlParser.GetCompiledInstance(String
    virtualPath, String inputFile, HttpContext context) +36
    System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String
    virtualPath, String inputFile, HttpContext context) +43
    System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String
    requestType, String url, String path) +44
    System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
    requestType, String path, String pathTranslated, Boolean useAppConfig) +699
    System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
    +95
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
    completedSynchronously) +173
    </stackTrace>
    A Traveler, Oct 12, 2004
    #1
    1. Advertising

  2. A Traveler

    A Traveler Guest

    Well, i finally figured it out, after a day of piece-by-piece rebuilding my
    page.

    I had a TD tag in my html code which i set to runat="server". I then added
    on an attribute named "page" where i was going to keep track of the custom
    page my grid was on (im paging by alpha-filters instead of numeric page
    numbers). When the page tried to render this control though, it was now an
    HtmlTableCell object, which has a Page property (derived from Control
    class). It thought i was trying to set that property = "" and it got all
    confused. By simply changing the name of my custom attribute from "page" to
    "pageindex", it works again. Apparently on a runat=server HTML tag, the
    framework will try to interpret any attributes specified as .NET Properties
    first, and if there isnt one by that name, then it treats them as HTML
    Attributes.

    CheerZ.

    "A Traveler" <> wrote in message
    news:...
    > Hello, i am having this problem. The exact error message is:
    >
    > "Unable to generate code for a value of type 'System.Web.UI.Page'. This
    > error occurred while trying to generate the property value for Page."
    >
    > After a lot of googling, all i can find that this applies to is when
    > trying to use enum-type datatypes as bit-vector flags, or when use
    > designers to make an expandable property in the property tool-window.
    > However, NEITHer of these cases apply to my page. This is only happening
    > on one page in the project. But the stack trace of the error (included at
    > the end) gives me no hint of where to even start looking to fix it, of
    > WHAt exactly might be wrong with the page.
    >
    > Thanks in advance,
    > - Arthur Dent.
    >
    > ===================================================
    >
    > <stackTrace>
    > [HttpException (0x80004005): Unable to generate code for a value of type
    > 'System.Web.UI.Page'. This error occurred while trying to generate the
    > property value for Page.]
    >
    > System.Web.Compilation.CodeDomUtility.GenerateExpressionForValue(PropertyInfo
    > propertyInfo, Object value, Type valueType) +2369
    >
    > System.Web.Compilation.TemplateControlCompiler.BuildBuildMethod(ControlBuilder
    > builder, Boolean fTemplate, PropertySetterEntry pse) +2545
    >
    > System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    > builder, Boolean fInTemplate, PropertySetterEntry pse) +794
    >
    > System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    > builder, Boolean fInTemplate, PropertySetterEntry pse) +352
    >
    > System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    > builder, Boolean fInTemplate, PropertySetterEntry pse) +352
    >
    > System.Web.Compilation.TemplateControlCompiler.BuildSourceDataTreeFromBuilder(ControlBuilder
    > builder, Boolean fInTemplate, PropertySetterEntry pse) +352
    > System.Web.Compilation.TemplateControlCompiler.BuildMiscClassMembers()
    > +51
    > System.Web.Compilation.PageCompiler.BuildMiscClassMembers() +9
    > System.Web.Compilation.BaseCompiler.BuildSourceDataTree() +1279
    > System.Web.Compilation.BaseCompiler.GetCompiledType() +129
    > System.Web.UI.PageParser.CompileIntoType() +59
    > System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() +126
    >
    > [HttpException (0x80004005): Unable to generate code for a value of type
    > 'System.Web.UI.Page'. This error occurred while trying to generate the
    > property value for Page.]
    > System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
    > fCreateIfNotFound) +692
    > System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() +125
    > System.Web.UI.TemplateParser.GetParserCacheItem() +88
    > System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String
    > virtualPath, String inputFile, HttpContext context) +116
    > System.Web.UI.TemplateControlParser.GetCompiledInstance(String
    > virtualPath, String inputFile, HttpContext context) +36
    > System.Web.UI.PageParser.GetCompiledPageInstanceInternal(String
    > virtualPath, String inputFile, HttpContext context) +43
    > System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String
    > requestType, String url, String path) +44
    > System.Web.HttpApplication.MapHttpHandler(HttpContext context, String
    > requestType, String path, String pathTranslated, Boolean useAppConfig)
    > +699
    >
    > System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
    > +95
    > System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
    > completedSynchronously) +173
    > </stackTrace>
    >
    A Traveler, Oct 13, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Weng Tianxiang
    Replies:
    5
    Views:
    1,313
    Christophe
    Feb 16, 2006
  2. Chris Bower
    Replies:
    4
    Views:
    1,629
    Chris Bower
    Nov 18, 2003
  3. xyz
    Replies:
    0
    Views:
    298
  4. Chris Bower

    Unable to generate code for a value of type...

    Chris Bower, Nov 17, 2003, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    247
    Chris Bower
    Nov 18, 2003
  5. KMILO
    Replies:
    0
    Views:
    168
    KMILO
    Apr 25, 2005
Loading...

Share This Page