I have one dropdownlist named drpdemo and consist some listitems as shown below
Design Code:
<asp:DropDownList ID="drpdemo" runat="server">
<asp:ListItem Value="213">Select</asp:ListItem>
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="0">0</asp:ListItem>
</asp:DropDownList>
Inline Code:
protected void Page_Load(object sender, EventArgs e)
{
drpdemo.Items.Remove(drpdemo.Items.FindByValue("0"));
}
Current Output:
Select
2
3
4
5
0
Above output comes with the 0, which i don't want it in output.
Expected Output:
Select
2
3
4
5
Note: Dont want to use any loop.