I work on razor asp.net core .i face issue selectedbranchid is inside post form form is get selected value without any issue
but if i use another post and get selectedbranchid it become null why
so How to solve issue please
on page model
[BindProperty]
public string SelectedBranchId { get; set; }
<div id="ShelfLabelPrintrSetupAdcSupport" style="margin-top:20px;">
<form id="FrmShelfLabelPrintrSetup" method="post" onsubmit="return validateForm() ">
<div class="row">
<div class="col-lg-12 col-12 row">
<div class="col-md-3 col-lg-2">
<label for="branch-selectlbl" style="margin-left:3px;font-size:15px;font-family: 'Open Sans', sans-serif;font-weight: bold;">Print Server</label>
<select id="branch-select" asp-for="SelectedBranchId" name="selectbranchid" class="form-select" style="margin-left:3px;font-size:15px;font-family: 'Open Sans' , sans-serif;font-weight: bold;" onchange="toggleButtonVisibility()">
<option value="0">--Select--</option>
@foreach (var branches in Model.branches)
{
<option value="@branches.iBranchCode">@branches.vBranchDesc</option>
}
</select>
</div>
<input type="hidden" id="SelectedText" name="SelectedText" asp-for="SelectedBranchId" value="SelectedBranchId" />
<div class="col-md-3 col-lg-2">
<br>
<button id="Searchtxt" type="submit" name="searchButton" value="search" asp-page-handler="Search" style="width:100px;margin-top:7px;" class="btn btn-primary">Search</button>
</div>
</div>
</div>
</form>
</div>
</div>
<button id="createTxt" data-toggle="modal" data-target="#CreateshelflabelModal" style="width:100px;margin-top:7px;margin-left:7px;display:none;" class="btn btn-primary">Create</button>
now i will check another post method not related to form or another form different with post
public ActionResult OnPostCreateUsers(string selectbranchid)
{
string selectedbranchid=SelectedBranchId; //here when check it become null
}
why bind property outside form become null and how to solve this issue