Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. I wrote this code:

C#
string selectedName = dpdCourse.SelectedItem.Value;
      var crs = DB.Courses.Where(c => c.Name == selectedName).First();
      IEnumerable< GaduatedStudent> gaduatedStd = DB.Users.OfType<GaduatedStudent>().Where(gdt => gdt.Id == crs.GdtStdUN);
      GridGaduated.DataSource = gaduatedStd;
      GridGaduated.DataBind();


But I get this error on the last line:
Constructor on type 'System.Data.Linq.Provider.DataBindingList`1[[User, App_Code.x9wmex0v, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]' not found.
Posted
Updated 1-Jun-12 20:00pm
v2
Comments
Rajesh Kariyavula 2-Jun-12 3:24am    
Where exactly are you getting the issue while fetching the data or while binding to the grid.
parisa heidari 2-Jun-12 8:08am    
Hi, While binding to the grid. it sets gaduatedStd as Grid DataSource but when it run (GridGaduated.DataBind();) it throws that error.
Rajesh Kariyavula 3-Jun-12 2:51am    
Are you getting data into "gaduatedStd"
parisa heidari 3-Jun-12 4:13am    
I'm solving this problem with changing relations and use sgldatasource.

A similar question[^] was asked earlier. The answer may be of some assistance to you.
 
Share this answer
 
Comments
parisa heidari 2-Jun-12 2:19am    
Thanks but i had written GridGaduated.DataBind();
i have answered similar question differece only is that it was on dropdownlist and it is on list i give you link of this question you use list in place of dropdown list.

how to add items to the dropdown inside gridview and how to bind it[^]
 
Share this answer
 
Comments
parisa heidari 2-Jun-12 8:15am    
I need to join two tables and the result set as gridview datasource so i cann't use sqldatasource to bind data to gridview

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900