I have a tabbed Razor page, on load there is no data to be retrieved from server, active tab set for first tab. However, when I update data on one tab and post it I want the page to get only data for that tab. What I have so far is:
html:
- <ul class="nav nav-tabs" id="PTWTab" role="tablist">
- <li class="nav-item">
- <a class="nav-link active" id="PTW-tab" data-toggle="tab" href="#PTW" aria-controls="ptw" aria-selected="true" style="width:200px">Permit To Worka>
- li>
- <li class="nav-item">
- <a class="nav-link" id="HazId-tab" data-toggle="tab" href="#HazId" aria-controls="hazid" aria-selected="false" style="width:200px">Hazard Identificationa>
- li>
- <li class="nav-item">
- <a class="nav-link" id="GasTest-tab" data-toggle="tab" href="#GasTest" aria-controls="gt" aria-selected="false" style="width:200px">Gas Testinga>
- li>
- <li class="nav-item">
- <a class="nav-link" id="IsoCert-tab" data-toggle="tab" href="#IsoCert" aria-controls="isocert" aria-selected="false" style="width:200px">Isolation Certificatea>
- li>
- ul>
- public async Task
OnPostIsoCertAsync( int? PTWNo) - {
- if (!ModelState.IsValid)
- {
- return Page();
- }
- var newIsoCert = await _context.ICContents.FindAsync(PTWNo);
- if (newIsoCert == null)
- {
- return NotFound();
- }
- if (await TryUpdateModelAsync
( - newIsoCert,
- "ICContent", // Prefix for form value.
- c => c.IdICD,
- c => c.IsoStep,
- c => c.EquipmentID,
- c => c.EquipmentDescription,
- c => c.EnSource,
- c => c.IsType,
- c => c.IsMethod,
- c => c.LockNo,
- c => c.PreparedBy,
- c => c.ImplementedBy,
- c => c.VerifiedBy,
- c => c.IsStatus))
- {
- await _context.SaveChangesAsync();
- return Page();
- }
- return Page();
- }
- public async Task
OnGetIsoCertAsync( int ptwNoId) - {
- PTWIsoCert = await (from a in _context.ICDatas.Where(a => a.PTWNo == ptwNoId)
- orderby a.IdICD
- join b in _context.ICContents on a.IdICD equals b.IdICD into TempData1
- from c in TempData1
- select new PTWIsoCert
- {
- IdICD = a.IdICD,
- PTWNo = ptwNoId,
- IsoDate = a.IsoDate,
- IsoStep = c.IsoStep,
- EquipmentID = c.EquipmentID,
- EquipmentDescription = c.EquipmentDescription,
- EnSource = (int)c.EnSource,
- IsType = (int)c.IsType,
- IsMethod = (int)c.IsMethod,
- LockNo = c.LockNo,
- PreparedBy = c.PreparedBy,
- ImplementedBy = c.ImplementedBy,
- VerifiedBy = c.VerifiedBy,
- IsStatus = (int)c.IsStatus
- }).ToListAsync();
- return Page();
- }

Marius VasilePosted Aug 16, 2020, 1:41 PM
Gas Testing
Isolation Certificate
Jenith ThakkarPosted Aug 10, 2020, 12:04 AM
This is your main view
So in place of DisplayEmployeeWebGrid you have to write your tab name and create a partial view with that tab name
how to create it ? you can find it from here
https://www.c-sharpcorner.com/UploadFile/ff2f08/partial-view-in-mvc/
Thank you
Marius VasilePosted Aug 9, 2020, 10:28 AM
Jenith ThakkarPosted Aug 9, 2020, 7:36 AM
if yes then convert it to partial views so you can render only that tab