Hi,
Model is not binded with Dropdownlist items on post method in MVC Razor
I have 1 page for Create and Update functionality (& display in DataTables.net)
there are 2 Radiobuttons. Upon click of radiobutton id="1To1", div id="div1To1" is visible; and upon click of radiobutton id="1ToMany", div id="div1ToMany" is visible. Both the div's got 3 dropdownlist; Study, Project, Scenario; where "Scenario DDL" is bind based on the selected item of "Study DDL" via JQuery. also got 1 checkbox along with Save & Cancel button.
Issues:
When "Upsert" method is called for radiobutton id="1To1", parameter "MappingStudyViewModel mappingStudyViewModel" is binded with StudyId, ProjectId --- why not ScenarioId is binded in model ??
To get ScenarioId (Scenario DDL control id="ddlScenario") I am using below code: string ddlSelectedScenarioValue = Request.Form["ddlScenario"].ToString();
Using StudyId, ProjectId, ScenarioId; I am fetching StudyName, ProjectName, ScenarioName using LINQ query and saving these values into DB table using model binding approach. (Please refer "Upsert" post method) Which is working fine.
"Upsert" method is called for radiobutton id="1ToMany", parameter "MappingStudyViewModel mappingStudyViewModel" is NOT bind with StudyId, ProjectId --- why am I not getting this id's in model ?
To get ScenarioId (Scenario DDL control id="ddlScenario2") I am using below code: string ddlSelectedScenario2Value = Request.Form["ddlScenario2"].ToString();
Please let me know how to get StudyId and Prorjct Id for radiobutton id="1ToMany", div id="div1To1" on click of Save button. What am I doing wrong ?
And also, how to save these multiple DDL items from Project DDL into DB using Model binding approach?
Thank you so much in advance.