I want to redirect on second tab after successfully data submission.
All 3 tabs are present in single view i.e. Provider.cshtml
Please check my code for reference.
using Microsoft.AspNetCore.Mvc;
using ThomosMason.Web.Models.ICD;
using ThomosMason.Web.Models.Provider;
using ThomosMason.Web.ServiceCall;
namespace ThomosMason.Web.Controllers.Controllers
{
public class ProviderController : Controller
{
IConfiguration Configuration;
public ProviderController(IConfiguration _configuration)
{
Configuration = _configuration;
}
public IActionResult AddProvider()
{
return View();
}
[HttpPost]
public IActionResult AddProvider(ManageProviderModel model)
{
if(ModelState.IsValid)
{
AccountApiCall accountApiCall = new AccountApiCall(Configuration["PrescriptionAPI"]);
model.createdBy = HttpContext.Request.Cookies["FullName"] != null ? HttpContext.Request.Cookies["FullName"].ToString() : "";
var Response = accountApiCall.PostAPIcall<GetProviderDetailModel>(model, "provider/personaldetailsadd", HttpContext.Request.Cookies["Token"].ToString());
//return Json(Response.message);
if (Response.status)
{
return RedirectToAction("Provider", "AddProvider");
}
else
{
ModelState.AddModelError("CustomError", Response.message);
return View();
}
}
else
{
return View();
}
}
public IActionResult Index()
{
return View();
}
}
}
<nav class="navbar navbar-expand-lg navbar-light bg-transparent py-4 px-4">
<div class="d-flex align-items-center">
<i class="fas fa-align-left primary-text fs-4 me-3" id="menu-toggle"></i>
<h2 class="fs-4 m-0">Add Provider</h2>
</div>
</nav>
<div class="master-tab-wrapper provider-wrapper">
<div class="container-fluid px-4">
<div class="stepper-wrapper">
<div class="card p-3 mb-3">
<ul class="nav nav-tabs mt-3" data-bs-tabs="tabs">
<li class="nav-item me-2">
<a class="nav-link active" aria-current="true" data-bs-toggle="tab"
href="#step1">Step 1
<h6>Personal Details</h6>
</a>
@Html.ValidationMessage("CustomError", new { @class = "text-danger" })
</li>
<li class="nav-item me-2">
<a class="nav-link" data-bs-toggle="tab" href="#step2">Step 2
<h6>License, Certifications & More</h6>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#step3">Step 3
<h6>Primary/Sub Specialities</h6>
</a>
</li>
</ul>
<form method="post" enctype="multipart/form-data" asp-controller="Provider" asp-action="AddProvider" class="tab-content mt-3">
<div class="tab-pane active" id="step1">
<div class="provider-details-wrapper">
<h6>Personal Details</h6>
<div class="row">
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="firstname">First Name</label>
@Html.TextBoxFor(c=>c.FirstName,new{ @class="form-control",id="firstname",placeholder="Enter First Name"})
<span asp-validation-for="FirstName" class="text-danger"></span>
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="middlename">Middle Name</label>
@Html.TextBoxFor(c=>c.MiddleName,new{ @class="form-control",id="middlename",placeholder="Enter Middle Name"})
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="lastname">Last Name</label>
@Html.TextBoxFor(c=>c.LastName,new{ @class="form-control",id="lastname",placeholder="Enter Last Name"})
<span asp-validation-for="LastName" class="text-danger"></span>
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="birthdate">Date of Birth</label>
@Html.TextBoxFor(m => m.DOB, new{ type = "date",@class="form-control"})
@* @Html.TextBox("birthdate", Model.DOB.Value ,"{0:yyyy-MM-dd}",new{ @style="width:100%", type="date" })*@
@*<input type="date" class="form-control" id="birthdate" required>*@
<span asp-validation-for="DOB" class="text-danger"></span>
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="email">Email Address</label>
@Html.TextBoxFor(c=>c.Email,new{ @class="form-control",id="email",placeholder="Enter Email"})
<span asp-validation-for="Email" class="text-danger"></span>
</div>
</div>
</div>
<div class="d-flex justify-content-end mt-5">
<a href="manage-provider.html" class="btn cancel-btn me-3">Back</a>
@* <a href="manage-provider.html" class="btn save-btn">Save & next</a>*@
<input type="submit" class="btn add-btn" value="Save & next">
</div>
</div>
</div>
<div class="tab-pane" id="step2">
<div class="provider-details-wrapper">
<h6>License, Certifications & Documents</h6>
<div class="row">
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="firstname">Document Name</label>
<input type="text" class="form-control" id="firstname">
</div>
</div>
<div class="col-lg-3 col-md-4">
<label for="state">State</label>
<div class="form-group">
<select class="form-control form-select">
<option>Noida</option>
<option value="1"></option>
<option value="2"></option>
</select>
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="isuuedate">Isuue Date</label>
<input type="date" class="form-control" id="isuuedate">
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="tax">Expiration Date</label>
<input type="date" class="form-control" id="tax">
</div>
</div>
</div>
<div class="d-flex justify-content-end mt-5">
<a href="manage-provider.html" class="btn cancel-btn me-3">Back</a>
<a href="manage-provider.html" class="btn save-btn">Save & next</a>
</div>
</div>
</div>
<div class="tab-pane" id="step3">
<div class="provider-details-wrapper">
<h6>Primary/Sub Specialities Details</h6>
<div class="row">
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="primary">Primary Specialities 1</label>
<input type="text" class="form-control" id="primary">
</div>
</div>
<div class="col-lg-3 col-md-4">
<div class="form-group">
<label for="code">Taxonamy Code</label>
<input type="text" class="form-control" id="code">
</div>
</div>
<div class="col-lg-2 col-md-2 align-self-center">
<button class="btn btn-trash mt-3 "><span
class="material-symbols-outlined align-middle">
delete
</span></button>
</div>
</div>
<div class="d-flex justify-content-end mt-5">
<a href="manage-provider.html" class="btn cancel-btn me-3">Back</a>
<a href="manage-provider.html" class="btn save-btn px-4">Save</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>