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; }
8 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Zulqadar IdrishiPosted Jan 2, 2020, 11:12 AM
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
}
}
Mark TaborPosted Dec 31, 2019, 11:51 PM
My Model class is below
Mark TaborPosted Dec 29, 2019, 1:03 AM
Veerendra AnnigerePosted Dec 28, 2019, 9:21 PM
Mark TaborPosted Dec 28, 2019, 9:06 AM
Ashutosh GuptaPosted Dec 28, 2019, 8:56 AM
Mark TaborPosted Dec 28, 2019, 8:49 AM
Ashutosh GuptaPosted Dec 28, 2019, 8:41 AM