Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Datagrid model binding error- the SelectMethod should return an IQueryable

$
0
0
     I have tried everything. I am using the select method to populate the grid but I am getting this error everytime!!:

When the DataBoundControl has paging enabled, either the SelectMethod should return an IQueryable<ItemType> or should have all these mandatory parameters : int startRowIndex, int maximumRows, out int totalRowCount



<asp:GridView runat="server" ID="supplierGrid" ItemType="princeportalweb.models.supplier" SelectMethod="SuppliersGrid_GetData" AutoGenerateColumns="false" AllowPaging="true" PageSize="25" AllowSorting="true"><Columns><asp:BoundField DataField="supplierid" HeaderText="id" SortExpression="supplierid" /><asp:BoundField DataField="suppliername" HeaderText="name" SortExpression="suppliername" /></Columns></asp:GridView>
       public IQueryable<supplier> SuppliersGrid_GetData([Control("searchText")] string search)

        {

            SupplierDBModel db = new SupplierDBModel();            

            var query = from s in db.suppliers
                        where s.suppliername.ToUpper() == "SUPPLIER"
                        select s;                                 
            return query;



          
    }
 public partial class SupplierDBModel : DbContext
    {    




        public SupplierDBModel()
            : base("name=SupplierDBModel")
        {


           // Database.SetInitializer(new MigrateDatabaseToLatestVersion<SupplierDBModel, EF6Console.Migrations.Configuration>());


        }

        public virtual DbSet<supplier> suppliers { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
        }
    }
 public partial class supplier
    {
        public int supplierid { get; set; }

        [Required]
        [StringLength(50)]
        public string suppliername { get; set; }

        [StringLength(50)]
        public string address1 { get; set; }

        [StringLength(50)]
        public string county { get; set; }

        [StringLength(50)]
        public string country { get; set; }

        [StringLength(50)]
        public string telephone { get; set; }

        [StringLength(50)]
        public string address2 { get; set; }

        [StringLength(11)]
        public string postcode { get; set; }

        [StringLength(20)]
        public string webstatus { get; set; }

        [StringLength(50)]
        public string status { get; set; }

        [StringLength(50)]
        public string LastreviewedBy { get; set; }

        [Column(TypeName = "datetime2")]
        public DateTime Whencompliant { get; set; }
        [Column(TypeName = "datetime2")]
        public DateTime Reviewdate { get; set; }


    }


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>