Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <script>
  2. $(document).ready(function () {
  3. $('.filelist').on('click', function (e) {
  4. var filePath = $(this).attr('value'); //value is attribute set in Html
  5. $('#partial').load('DevelopmentPartial', { path1: filePath });
  6. });
  7. });
  8. </script>
  9.  
  10. StudentsCodes modelSC;
  11.  
  12. public DevelopmentController()
  13. {
  14. m4 = new MicroG4();
  15. modelSC = new StudentsCodes();
  16. }
  17. public ActionResult Index()
  18. {
  19. modelSC.Student = (Student)CurrentUser;
  20. var user = UserManager.FindById(((Student)CurrentUser).InstructorID);
  21. modelSC.Instructor =(Instructor) user;
  22. //modelSC.path = "~/Content/" + CurrentUser.UserName + "/CompilerProject/src/Driver.java";
  23. return View(modelSC);
  24. }
  25. public PartialViewResult DevelopmentPartial(string path1)
  26. {
  27. modelSC.Student = (Student)CurrentUser;
  28. var user = UserManager.FindById(((Student)CurrentUser).InstructorID);
  29. modelSC.Instructor = (Instructor)user;
  30. modelSC.path = path1;
  31. modelSC.code = "";
  32. if (modelSC.path == null)
  33. {
  34. modelSC.code = "";
  35. }
  36. else
  37. {
  38. try
  39. {
  40. modelSC.code = System.IO.File.ReadAllText(Server.MapPath(modelSC.path));
  41. }
  42. catch (Exception e)
  43. {
  44. modelSC.code = "";
  45. }
  46. }
  47. return PartialView(modelSC);
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement