ahmed salah

ahmed salah

  • 1.2k
  • 547
  • 64.3k

How to get selected printer name on razor page ?

Jun 26 2023 9:20 AM

I work on asp.net razor pages . i need to get selected text name from drop down  on page model 

 

<form id="FrmShelfLabelPrintrSetup" method="post">
<select id="PrinterName-select" asp-for="SelectedPrinterId" name="selectprinterid" class="form-select" style="margin-left:3px;font-size:15px;font-family: 'Open Sans' , sans-serif;font-weight: bold;">
                            <option value="0">--Select--</option>
                            @foreach (var printer in Model.PrinterList)
                            {

                                <option value="@printer.UserPC">@printer.PrinterName</option>


                            }
                        </select>
<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>

</form>

How to get selected text on page model 

public class LabelPrintingModel : PageModel
    {

How to get selected text here 

   }


Answers (2)