Wednesday, 29 February 2012

.Net Beginners : How to add items in DropDownList/ListBox items from the server side?

We can also add items in DropDownList/ListBox from server side.
There is one method Items.Add of DropDownList/ListBox to add items.

Example :
        Dim objListItem As ListItem
        objListItem = New ListItem("Software", 1)
        ddlProduct.Items.Add(objListItem)

        objListItem = New ListItem("Hardware", 2)
        ddlProduct.Items.Add(objListItem)

In this exaple we are adding to Items in List box from server.

No comments:

Post a comment