pius joshua

pius joshua

  • 1.4k
  • 29
  • 5.7k

How to generate position from a table using EF

Jul 4 2016 6:27 AM
Good day All, I need your help, I want to generate Position from a list of record for a particular user

 
  1. //I have a table Named Mark   
  2. MarkID     UserId      SubjectName      TotalScore  
  3. 1           20            English         60.00  
  4. 2           21            English         70.00  
  5. 3           20             Maths          80.00  
  6. 4           21             Maths          80.00  
  7.    
  8. // From the Table above i want to automatically generate Subject position for each each user in a gridview like this  
  9. MarkID     UserId      SubjectName      TotalScore     Postition  
  10. 1           20            English         60.00         2  
  11. 3           20             Maths          80.00         1  
  12.    
  13. How do i automatically generate the subject position on it  
  14.    
  15. Normally this is what i have tried so far to get the list of a particular record  
  16. var acc  = from c in cdc.Marks where c.userId = "20" select c).tolist();  
  17. gridview1.datasource = acc;  
  18. gridview.datindind();  
  19.    
  20. //The above code only generate the student records and displays it on a gridview but automatically generating Position without is what i am looking for.. Please your help is really needed..  
  21.   
  22. Thanks in advance  
 

Answers (4)