Hi
My requirement i had saved for multiple subjects, multiple courses and multiple school levels and i want to show it in the grid as below as comma separated and i am trying to fetch as a list From the don't know how to make to show in grid like below
For ex:
subject schoollevel courses
Maths Elementary ALgebra,Geometry,statistics
English Elemntary 3rd grade english,4th grade english
Maths Middle school ALgebra,Geometry,statistics
public ActionResult GetCoursetut(int? TutorID)
{
BLDal objBLDal = new BLDal();
DataTable dt = new DataTable();
OracleParameter[] paramusp = new OracleParameter[2];
List<TutorProfileupdate> objCourses = new List<TutorProfileupdate>();
paramusp[0] = objBLDal.CreateInParameter("iTutorid", OracleType.Number, TutorID);
paramusp[1] = objBLDal.CreateOutParameter("ocursor", OracleType.Cursor);
dt = objBLDal.GetDataTableStoreProcedure("SESSION_ROUTING.Tutor_course_details", paramusp, 1);
if (dt != null && dt.Rows.Count > 0)
{
objCourses = (from DataRow _ctx in dt.Rows
select new TutorProfileupdate
{
CourseID = _ctx["COURSE_ID"] == DBNull.Value ? "" : _ctx["COURSE_ID"].ToString(),
CourseName = _ctx["Coursename"] == DBNull.Value ? "" : _ctx["Coursename"].ToString(),
SubjectId = _ctx["subject_id"] == DBNull.Value ? "" : _ctx["subject_id"].ToString(),
Subject = _ctx["subjectname"] == DBNull.Value ? "" : _ctx["subjectname"].ToString(),
SchoolLevel = _ctx["title"] == DBNull.Value ? "" : _ctx["title"].ToString(),
SchoolLevelId = _ctx["school_level_id"] == DBNull.Value ? "" : _ctx["school_level_id"].ToString()
}).ToList();
// var str = (string.Join(",", objCourses.Select(x => x.CourseID.ToString()).ToArray()));
}
return Json(objCourses, JsonRequestBehavior.AllowGet);
}
var tutcoursUrl = '@Url.Action("GetCoursetut", "Common", new { Area = "" })';
$.ajax({
type: "GET",
url: tutcoursUrl,
data: {
'TutorID': selectedtutorID
},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
debugger;
if (data != undefined && data.length > 0) {
$.each(data, function (i, Tutor) {
debugger;
selectedCourses += Tutor.CourseName + ',';
selectedCoursesId += Tutor.CourseID + ',';
tab.append('<tr><td name="sub">' + Tutor.Subject + '</td><td hidden name="subId">' + Tutor.SubjectId + '</td><td name="sclevl">' + Tutor.SchoolLevel + '</td><td hidden name="sclevlId">' + Tutor.SchoolLevelId + '</td><td name="selectdcours">' + selectedCourses + '</td><td hidden name="selectdcoursId">' + selectedCoursesId + '</td><td></td><td><button class="btnedit">Edit</button></td><td><button class="btndelete">Delete</button></td></tr>');
});
}
},
error: function (data) {
alert("fail");
}
});
Above is my code which i tried
Could you please help me in this as soon as possible?