Don't work asp:DropDownList . . . . . . . . . . . . ... . ...... .
. .. .. View result
Add.cshtml using Layout = "_Layout.cshtml"
@section Head{
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="~/css/make-ad.css" rel="stylesheet" />
<title>Document</title>
<form asp-controller="Item" asp-action="Add" method="post">
<label> Category</label>
<input asp-for="CategoryId" type="text" />
<asp:DropDownList class="ddlstyle"ID="DropDownList1" runat="server" >
<asp:ListItem Value="">Please Select</asp:ListItem>
<asp:ListItem>New Delhi </asp:ListItem>
<asp:ListItem>Greater Noida</asp:ListItem>
<asp:ListItem>NewYork</asp:ListItem>
<asp:ListItem>Paris</asp:ListItem>
<asp:ListItem>London</asp:ListItem>
</asp:DropDownList>
<button type="submit">
Add
</button>
</form>
CodePudding user response:
instead of web form asp.net try this html5 ddl
<select id="DropDownList1">
<option value="">Please Select</option>
<option value="Greater Noida">Greater Noida</option>
<option value="NewYork">NewYork</option>
<option value="Paris">Paris</option>
</select>