locked
Cannot implicitly convert type 'System.Web.DynamicData.MetaTable' to 'List.MetaTableSecurity'. RRS feed

  • Question

  • User-299966805 posted
    How do you cast Table?
     
    CS0266: Cannot implicitly convert type 'System.Web.DynamicData.MetaTable' to 'List.MetaTableSecurity'. An explicit conversion exists (are you missing a cast?) 

    using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Security.Principal; using System.Web.DynamicData; using System.Web.Routing; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.Expressions; using System.Web.DynamicData.ModelProviders; using System.Linq; public partial class List : System.Web.UI.Page { public partial class MetaTableSecurity : MetaTable { public MetaTableSecurity(MetaModel metaModel, TableProvider tableProvider) : base(metaModel, tableProvider) { } public override bool CanDelete(System.Security.Principal.IPrincipal principal) { return false; } //public override IQueryable GetQuery(object context) //{ // IQueryable query = base.GetQuery(context); // return query; //} } protected MetaTableSecurity table; protected void Page_Init(object sender, EventArgs e) { table = DynamicDataRouteHandler.GetRequestMetaTable(Context); GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context)); GridDataSource.EntityTypeFilter = table.EntityType.Name; } protected void Page_Load(object sender, EventArgs e) { Title = table.DisplayName; GridDataSource.Include = table.ForeignKeyColumnsNames; // Disable various options if the table is readonly if (table.IsReadOnly) { GridView1.Columns[0].Visible = false; InsertHyperLink.Visible = false; GridView1.EnablePersistedSelection = false; } } protected void Label_PreRender(object sender, EventArgs e) { Label label = (Label)sender; DynamicFilter dynamicFilter = (DynamicFilter)label.FindControl("DynamicFilter"); QueryableFilterUserControl fuc = dynamicFilter.FilterTemplate as QueryableFilterUserControl; if (fuc != null && fuc.FilterControl != null) { label.AssociatedControlID = fuc.FilterControl.GetUniqueIDRelativeTo(label); } } protected override void OnPreRenderComplete(EventArgs e) { RouteValueDictionary routeValues = new RouteValueDictionary(GridView1.GetDefaultValues()); InsertHyperLink.NavigateUrl = table.GetActionPath(PageAction.Insert, routeValues); base.OnPreRenderComplete(e); } protected void DynamicFilter_FilterChanged(object sender, EventArgs e) { GridView1.PageIndex = 0; } protected void GridView1OnPreRender(object sender, EventArgs e) { if (GridView1.Rows.Count > 0) { GridView1.UseAccessibleHeader = true; GridView1.HeaderRow.TableSection = TableRowSection.TableHeader; } } protected void OnFilterSelectedIndexChanged(object sender, EventArgs e) { GridView1.PageIndex = 0; } protected void GridDataSource_Selecting(object sender, EntityDataSourceSelectingEventArgs e) { string s = e.SelectArguments.SortExpression; if (s.StartsWith("it.")) e.SelectArguments.SortExpression = s.Substring(3); } protected bool CanDelete(System.Security.Principal.IPrincipal principal) { return false; } }

    Tuesday, August 14, 2012 7:21 PM

All replies

  • User3866881 posted

    Hi,

    On which statement is your error thrown out?

    Thursday, August 16, 2012 8:55 PM
  • User-330204900 posted

    Hi Cooper what are you trying to achive?

    Friday, August 17, 2012 5:57 AM