Linq query to get all the records
-
Hi, I have a table named "Customers" which has 6 columns with 15 rows. I want to show all athe records in Gridview using linq quieries. I am using this query but it is not giving me all the records. How can I show all the records in Gridview. var type = (from p in entities.Customers select p) this.Gridview1.DataSource = type; this.GridView1.DataBind();
-
Hi, I have a table named "Customers" which has 6 columns with 15 rows. I want to show all athe records in Gridview using linq quieries. I am using this query but it is not giving me all the records. How can I show all the records in Gridview. var type = (from p in entities.Customers select p) this.Gridview1.DataSource = type; this.GridView1.DataBind();
From what I can see there is nothing wrong with that statement. You should be getting all records. Are you sure the GridView isnt within a fixed height table/div? Once the gridview fills with rows it may be rolling off the bottom of the table/div and is basically being trimmed.
-
Hi, I have a table named "Customers" which has 6 columns with 15 rows. I want to show all athe records in Gridview using linq quieries. I am using this query but it is not giving me all the records. How can I show all the records in Gridview. var type = (from p in entities.Customers select p) this.Gridview1.DataSource = type; this.GridView1.DataBind();
Here is the answer to your question Everything is correct except that you need to type cast to the particular Entity before you r binding the source to your grid. e.g.
public List<Customers> FetchRecord()
{
return( from p in entities.Customers select p )
}this.Gridview1.DataSource = FetchRecord();
this.GridView1.DataBind();Hope this helps :)
Niladri Biswas