locked
InvalidOperationException was unhandled by usercode RRS feed

  • Question

  • User-309523270 posted

    Hi,

    I have the following table structure:

    CodeTable

    ==========

    Category - PK

    Code - PK

    Value

     When I click this link in the menu item, I encounter this error on the List.aspx on the PageTemplate folder:

    "Invalid OperationException was unhandled by user code.  Unable to convert type System.String to System.Web.DynamicData.MetaTable."

     Error on the line underlined:

     

     

     protected void Page_Init(object sender, EventArgs e)

    table = DynamicDataRouteHandler.GetRequestMetaTable(Context);

     

     

     

    GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));

    GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName;

    if (table.EntityType != table.RootEntityType)

     

    {  GridQueryExtender.Expressions.Add(new OfTypeExpression (table.EntityType));  }

     

     

    }

    If anybody has some ideas please let me know.

     Thanks,

    TinaC99

     

    Friday, April 15, 2011 7:47 PM

All replies

  • User-330204900 posted

    Can you copy and paste the whole yellow screen of death please

    Saturday, April 16, 2011 2:57 PM
  • User-309523270 posted
    

    Here's the error page of the error:

    Unable to convert type 'System.String' to 'System.Web.DynamicData.MetaTable'

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Unable to convert type 'System.String' to 'System.Web.DynamicData.MetaTable'

    Source Error:

    Line 22:         {
    Line 23:             table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
    Line 24:             GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
    Line 25:             GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName;
    Line 26:             if (table.EntityType != table.RootEntityType)


    Source File: C:\apps\grip\GRIPS\GRIPS\GRIPS\DynamicData\PageTemplates\List.aspx.cs    Line: 24

    Stack Trace:

    [InvalidOperationException: Unable to convert type 'System.String' to 'System.Web.DynamicData.MetaTable']
       System.Web.DynamicData.Misc.ChangeType(Object value, Type type) +221897
       System.Web.DynamicData.MetaTable.GetColumnValuesFromRoute(HttpContextBase context) +350
       System.Web.DynamicData.MetaTable.GetColumnValuesFromRoute(HttpContext context) +40
       GRIPS.List.Page_Init(Object sender, EventArgs e) in C:\apps\grip\GRIPS\GRIPS\GRIPS\DynamicData\PageTemplates\List.aspx.cs:24
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.EventHandler.Invoke(Object sender, EventArgs e) +0
       System.Web.UI.Control.OnInit(EventArgs e) +91
       System.Web.UI.Page.OnInit(EventArgs e) +12
       System.Web.UI.Control.InitRecursive(Control namingContainer) +140
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +480
    



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

    Monday, April 18, 2011 4:17 PM
  • User-330204900 posted

    Hi Tinac99, is this a default app or have you made some changes?

    Tuesday, April 19, 2011 7:48 AM