ASP.NET Razor Pages



  • ASP.NET MVC architecture eke razor page ekakata bootstrap select ekak daganne kohomada?? stackoverflow walath tiakk baluwa..eth harigiye nehe

    me tiyenne normal text box ekak

    <div class="form-group form-floating-label">
    @Html.EditorFor(model => model.UserEmail, new { htmlAttributes = new { @class = "form-control input-border-bottom" } })
    @Html.LabelFor(model => model.UserEmail, htmlAttributes: new { @class = "placeholder" })
    </div>

    model eke select eke options tika damma me widiyata

    public IEnumerable <SelectListItem> TypeList
    {
    get
    {

                return new List <SelectListItem>
    
        {
            new SelectListItem { Text = "Factory Engineering", Value = "Factory Engineering"},
            new SelectListItem { Text = "Production Engineering", Value = "Production Engineering"},
            new SelectListItem { Text = "Autonomation", Value = "Autonomation"},
    
    
        };
            }
        }
    

    dn meka razor ekata render karaganna widiyak dannawada?



  • dotner core razor or dotnetframework razor?



  • with dotnet framewor mvc 4 and above u can use

    @{
    List<SelectListItem> listItems= new List<SelectListItem>();
    listItems.Add(new SelectListItem
    {
    Text = "Exemplo1",
    Value = "Exemplo1"
    });
    listItems.Add(new SelectListItem
    {
    Text = "Exemplo2",
    Value = "Exemplo2",
    Selected = true
    });
    listItems.Add(new SelectListItem
    {
    Text = "Exemplo3",
    Value = "Exemplo3"
    });
    }

    @Html.DropDownListFor(model => model.tipo, listItems, "-- Select Status --")