Hello Team,
Currently I am working in development project and I am trying to load in page load dropdown and texbox in the same .Cshtml page.
But to call two action methods in the same view.cshml , I have texbox other details I am using one action method and other dropdown I am using another action method calling to laod from DB.
1. public IActionResult Index(H1BOptionDetails H1Bdetails)(textbox data loading using this action method)
2.public async Task

Amit MohantyRank #112 · 20K reputationPosted Jun 3, 2025, 1:30 AM EDT
With a .cshtml Razor view, you cannot directly call two action methods from a single
Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Jun 3, 2025, 3:46 AM EDT
In ASP.NET Core MVC, you cannot directly call two action methods from a single
action. However, you can load data for both the textbox and dropdown in a single action method (typically theIndexaction) and bind them in the view.The recommended approach is to use a ViewModel and combine both data loads in one action:
// Create a ViewModel public class H1BViewModel { public H1BOptionDetails H1BDetails { get; set; } // For textbox public List DropdownOptions { get; set; } // For dropdown }// Update the Index Action Method public async Task Index() { // Load textbox data var h1bDetails = await GetH1BDetailsAsync(); // Your DB call for textbox // Load dropdown data var dropdownData = await GetDropdownDataAsync(); // Your DB call for dropdown var dropdownOptions = dropdownData.Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Name }).ToList(); // Build the ViewModel var viewModel = new H1BViewModel { H1BDetails = h1bDetails, DropdownOptions = dropdownOptions }; return View(viewModel); }Good Luck!