Can someone show me a reference example to show create and list view on same razor view might be using partial view using viewmodels , Second quesstion how I can achieve cascade dropdown list in asp.net core like I have one table with columns
(ID,STATE,SCHOOL) ID IS INTEGER AND STATE AND SCHOOL BOTH ARE STRING NOW the issue is I have different ID's as its unique and primary key but STATE Are same and Schools are different like below
| ID | STATE | SCHOOL |
| 1 | MAIN | A |
| 2 | SIDE | B |
| 3 | SIDE | C |
| 4 | MAIN | D |
NOW I WANT TO SEGREGATE THE TABLE BASED ON STATE NOT ON ID , LIKE IF I SELECT MAIN THEN ALL MAIN SCHOOLS LIKE A AND D should appear and when I SELECT SIDE THEN ALL SIDE SCHOOLS LIKE B & C appear both are text , can someone share how to achieve this in razor view , either using jquery ,javascript or normal view.
My first question is about how to show create and list view in one razor view .
Jayraj ChhayaPosted Aug 2, 2024, 7:39 AM
To display both create and list views on the same Razor view, you can utilize partial views and ViewModels in ASP.NET Core. By structuring your ViewModel to contain the necessary data for both creating and listing items, you can render different sections of the view accordingly.
For implementing cascading dropdown lists based on the 'STATE' column in ASP.NET Core, you can use JavaScript or jQuery to handle the dynamic filtering based on the selected 'STATE'. By capturing the change event of the dropdown list, you can make AJAX calls to fetch and populate the dependent dropdown list dynamically.