hi I have a form in which i have two dropdownlist and two textboxes , these dropdownlist having multiselect options as well , Now i want to save multiple rows for them just see below.
you can see i have selected two teachers and two coruses i want to save four rows into the database like first two rows for the first teacher (For two courses ) and last two rows for the second teachers ( for two courses)
how to achieve it , i am sharing my model class as well I have not taken courses and teacher as list insted i took them as normal int type .
how to achieve it , i am sharing my model class as well I have not taken courses and teacher as list insted i took them as normal int type .
public int? Course_Id { get; set; }
public int? Teacher_Id { get; set; }

Ashutosh GuptaRank #805 · 2.9K reputationPosted Dec 28, 2019, 3:41 AM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 28, 2019, 3:49 AM EST
Ashutosh GuptaRank #805 · 2.9K reputationPosted Dec 28, 2019, 3:56 AM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 28, 2019, 4:06 AM EST
Veerendra AnnigereRank #927 · 2.2K reputationPosted Dec 28, 2019, 4:21 PM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 28, 2019, 8:03 PM EST
Mark TaborRank #914 · 2.3K reputationPosted Dec 31, 2019, 6:51 PM EST
My Model class is below
Zulqadar IdrishiRank #2,956 · 488 reputationPosted Jan 2, 2020, 6:12 AM EST
String[] ArrTeacher=Teacher_Id.Split(',');
String[] ArrCourse=Course_Id.Split(',');
for(int i=0;i
var teacherid=ArrTeacher[i];
for(int j=0;j
//Now insert the teacher and course details to TblSemCourseTeacher table
InsertTblSemCourseTeacher(ArrCourse[j],teacherid,AutoID); //Inserting One Row EachTime
}
}