d developer

d developer

  • NA
  • 13
  • 4.3k

count of list items of dropdownlist on button click

May 29 2015 1:23 PM

<asp:DropDownList runat="server" ID="ddlAssigned" CssClass="BodyFont">
<asp:ListItem Text="Rajesh" Value=" Rajesh "></asp:ListItem>
<asp:ListItem Text="vinay" Value=" vinay "></asp:ListItem>
<asp:ListItem Text="hari" Value=" hari "></asp:ListItem>

<asp:ListItem Text="Anand" Value=" Anand "></asp:ListItem>

</asp:DropDownList>

<asp:Button runat="server" ID="button1" Text=”send” onClick=”button1_Click”></asp:Button>

On each button click, on selection of the dropdownlist item, get the count of selected listitem and put it in a textbox.

Output:

Rajesh: 2(selected 2 times on button click)

Vinay : 5(selected 5 times)


Answers (5)