Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function () {
- $('.filelist').on('click', function (e) {
- var filePath = $(this).attr('value'); //value is attribute set in Html
- $('#partial').load('DevelopmentPartial', { path1: filePath });
- });
- });
- </script>
- StudentsCodes modelSC;
- public DevelopmentController()
- {
- m4 = new MicroG4();
- modelSC = new StudentsCodes();
- }
- public ActionResult Index()
- {
- modelSC.Student = (Student)CurrentUser;
- var user = UserManager.FindById(((Student)CurrentUser).InstructorID);
- modelSC.Instructor =(Instructor) user;
- //modelSC.path = "~/Content/" + CurrentUser.UserName + "/CompilerProject/src/Driver.java";
- return View(modelSC);
- }
- public PartialViewResult DevelopmentPartial(string path1)
- {
- modelSC.Student = (Student)CurrentUser;
- var user = UserManager.FindById(((Student)CurrentUser).InstructorID);
- modelSC.Instructor = (Instructor)user;
- modelSC.path = path1;
- modelSC.code = "";
- if (modelSC.path == null)
- {
- modelSC.code = "";
- }
- else
- {
- try
- {
- modelSC.code = System.IO.File.ReadAllText(Server.MapPath(modelSC.path));
- }
- catch (Exception e)
- {
- modelSC.code = "";
- }
- }
- return PartialView(modelSC);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement