Associate
		
		- Joined
- 27 Jan 2005
- Posts
- 1,416
- Location
- S. Yorks
Am trying to use LIQ to populate dropdown lists and also a gridview, been following one of the many online tutorials and come up with the following:
	
	
	
		
As this is just a test to see how to work with LINQ I am trying to return the entire table to a gridview, the problem lies in that nothing gets displayed to the gridview and I am not sure why?
I can see that CCArea contains 3012 rows, so it has the data, so it must be something to do with the next two lines.
Do I have to populate the datagrid with columns prior to binding the datasource or will the columns autogenerate?
Any other ideas?
Matt
	
		
			
		
		
	
				
			
		Code:
	
	 CCDataContext db = new CCDataContext();
                        string connectionString = System.Configuration.ConfigurationManager.AppSettings["ABPConnectionString1"];
                        db.Connection.ConnectionString = connectionString;
                        
                        var CCArea =
                        from c in db.tbl_CC_AreaInfos 
                        select c;
                        
                        GrdDynamic.DataSource = CCArea.ToList();
                        GrdDynamic.DataBind();As this is just a test to see how to work with LINQ I am trying to return the entire table to a gridview, the problem lies in that nothing gets displayed to the gridview and I am not sure why?
I can see that CCArea contains 3012 rows, so it has the data, so it must be something to do with the next two lines.
Do I have to populate the datagrid with columns prior to binding the datasource or will the columns autogenerate?
Any other ideas?
Matt
 
	 
 