User77

User77

  • NA
  • 52
  • 26.4k

Select different Text of Dropdown if all items value is same

Oct 28 2016 12:50 AM
Hi in my web application, i have Dropdown control is
 
<asp:DropDownList ID="ddlTypes" runat="server" Width="156px">
<asp:ListItem Text="----Select----" Value="0"></asp:ListItem>
<asp:ListItem Text="Adjustments" Value="1"></asp:ListItem>
<asp:ListItem Text="Charges" Value="2"></asp:ListItem>
<asp:ListItem Text="Payments" Value="1"></asp:ListItem>
<asp:ListItem Text="Write Off" Value="1"></asp:ListItem>
</asp:DropDownList>
 
For my requirement i take some items are same values but when i select the selected different item in dropdown the text shows "Adjustments" only 
 
if (ddlTypes.SelectedItem.Text.ToString() == "Adjustments")
{
//some conditions
}
else if (ddlTypes.SelectedItem.Text.ToString() == "Payments")
 //some conditions
}
else if (ddlTypes.SelectedItem.Text.ToString() == "Write Off")
{
//some conditions
 
here the text is shows only "Adjustments" not showing when i selected different text. Can anyone please tell me how can i select different with items have same values. 
Thank you
 

Answers (5)